From 378bc504fcc3ea8634d1eda9925599060f1fe209 Mon Sep 17 00:00:00 2001 From: XMRig Date: Thu, 25 Apr 2019 02:22:53 +0700 Subject: [PATCH] Use null for unknown hashrate in API. --- src/api/v1/ApiRouter.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/api/v1/ApiRouter.cpp b/src/api/v1/ApiRouter.cpp index 1f3641c37..91395939c 100644 --- a/src/api/v1/ApiRouter.cpp +++ b/src/api/v1/ApiRouter.cpp @@ -40,13 +40,15 @@ #include "workers/Workers.h" -static inline double normalize(double d) +static inline rapidjson::Value normalize(double d) { + using namespace rapidjson; + if (!isnormal(d)) { - return 0.0; + return Value(kNullType); } - return floor(d * 100.0) / 100.0; + return Value(floor(d * 100.0) / 100.0); }