]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/other/smux/smux.cpp
Fixed parsing parameters with empty values.
[stg.git] / projects / stargazer / plugins / other / smux / smux.cpp
index 09cb4636795b1f72d567dc6274e2d74f788a2fad..9ff739cb0fa43468f8268fb238d0016ecccc29fe 100644 (file)
@@ -24,9 +24,6 @@ namespace
 {
 PLUGIN_CREATOR<SMUX> smc;
 
-bool SPrefixLess(const Sensors::value_type & a,
-                 const Sensors::value_type & b);
-
 bool SPrefixLess(const Sensors::value_type & a,
                  const Sensors::value_type & b)
 {
@@ -57,7 +54,7 @@ int p;
 
 pv.param = "Port";
 pvi = std::find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
     {
     errorStr = "Parameter \'Port\' not found.";
     printfd(__FILE__, "Parameter 'Port' not found\n");
@@ -73,7 +70,7 @@ port = static_cast<uint16_t>(p);
 
 pv.param = "Password";
 pvi = std::find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
     {
     errorStr = "Parameter \'Password\' not found.";
     printfd(__FILE__, "Parameter 'Password' not found\n");
@@ -86,7 +83,7 @@ else
 
 pv.param = "Server";
 pvi = std::find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end() || pvi->value.empty())
     {
     errorStr = "Parameter \'Server\' not found.";
     printfd(__FILE__, "Parameter 'Server' not found\n");