From a83ecb36db2831170f63e2ca3c59b617c0d715b5 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Tue, 24 May 2016 03:47:31 +0200 Subject: [PATCH] fix(memory): Set vars to 0 if exception is thrown --- src/modules/memory.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/memory.cpp b/src/modules/memory.cpp index c9822b22..d8139de9 100644 --- a/src/modules/memory.cpp +++ b/src/modules/memory.cpp @@ -45,6 +45,9 @@ bool MemoryModule::update() buffer >> rdbuf; //kbytes_free = std::atol(rdbuf.c_str()); buffer >> rdbuf; kbytes_available = std::atol(rdbuf.c_str()); } catch (std::ios_base::failure &e) { + kbytes_total = 0; + // kbytes_free = 0; + kbytes_available = 0; log_error("Failed to read memory values: "+ STR(e.what())); }