File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ void httpServer(tcp::acceptor& acceptor, tcp::socket& socket) {
9999 std::string calibTasksJson;
100100 const std::lock_guard<std::mutex> lock (gMapAccess );
101101 calibTasksJson += " [" + std::to_string (0 );
102+ int countOk = 0 ;
102103 for (const auto & run : gStats ) {
103104 if (run.second .TasksPerCalib .find (calib) != run.second .TasksPerCalib .end ()) {
104105 calibTasksJson += " , \" " ;
@@ -113,9 +114,14 @@ void httpServer(tcp::acceptor& acceptor, tcp::socket& socket) {
113114 } else {
114115 calibTasksJson += " ,0" ;
115116 }
117+ countOk++;
116118 }
117119 }
118120 calibTasksJson += " ]" ;
121+ // workaround to set valid reply if nothing to report
122+ if (!countOk) {
123+ calibTasksJson = " [0, \"\" , 0, 0]" ;
124+ }
119125 beast::ostream (response.body ()) << jsonPrefix << calibTasksJson << jsonSuffix << ' \n ' ;
120126 });
121127 connection->start ();
You can’t perform that action at this time.
0 commit comments