File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -64,11 +64,18 @@ void Thing::Invoke(const cJSON* command) {
6464 throw std::runtime_error (" Parameter " + param.name () + " is required" );
6565 }
6666 if (param.type () == kValueTypeNumber ) {
67- param.set_number (input_param->valueint );
67+ if (cJSON_IsNumber (input_param)) {
68+ param.set_number (input_param->valueint );
69+ }
6870 } else if (param.type () == kValueTypeString ) {
69- param.set_string (input_param->valuestring );
71+ if (cJSON_IsString (input_param) || cJSON_IsObject (input_param) || cJSON_IsArray (input_param)) {
72+ std::string value_str = input_param->valuestring ;
73+ param.set_string (value_str);
74+ }
7075 } else if (param.type () == kValueTypeBoolean ) {
71- param.set_boolean (input_param->valueint == 1 );
76+ if (cJSON_IsBool (input_param)) {
77+ param.set_boolean (input_param->valueint == 1 );
78+ }
7279 }
7380 }
7481
You can’t perform that action at this time.
0 commit comments