@@ -124,6 +124,9 @@ void json_to_cpp_code(Logger& logger, const JsonValue& json, const std::string&
124124 case ControllerCategory::RIGHT_JOYCON:
125125 output_text = json_to_cpp_code_joycon (history_json);
126126 break ;
127+ default :
128+ // generate empty text if ControllerCategory is not one of the above
129+ break ;
127130 }
128131
129132 QFile file (QString::fromStdString (output_file_name + " .txt" ));
@@ -185,6 +188,8 @@ std::string json_to_cpp_code_pro_controller(const JsonArray& history){
185188 case NonNeutralControllerField::NONE:
186189 result += " pbf_wait(context, " + std::to_string (duration_in_ms) + " ms);\n " ;
187190 break ;
191+ default :
192+ throw ParseException (" Unexpected NonNeutralControllerField enum." );
188193 }
189194 }
190195 );
@@ -228,6 +233,8 @@ std::string json_to_cpp_code_joycon(const JsonArray& history){
228233 case NonNeutralControllerField::NONE:
229234 result += " pbf_wait(context, " + std::to_string (duration_in_ms) + " ms);\n " ;
230235 break ;
236+ default :
237+ throw ParseException (" Unexpected NonNeutralControllerField enum." );
231238 }
232239 }
233240 );
@@ -264,6 +271,9 @@ void json_to_pbf_actions(SingleSwitchProgramEnvironment& env, CancellableScope&
264271 json_to_pbf_actions_joycon (context, history_json);
265272 break ;
266273 }
274+ default :
275+ // do nothing if the ControllerCategory is not one of the above.
276+ break ;
267277 }
268278
269279 }catch (ParseException& e){
@@ -307,6 +317,8 @@ void json_to_pbf_actions_pro_controller(ProControllerContext& context, const Jso
307317 case NonNeutralControllerField::NONE:
308318 pbf_wait (context, Milliseconds (duration_in_ms));
309319 break ;
320+ default :
321+ throw ParseException (" Unexpected NonNeutralControllerField enum." );
310322 }
311323 }
312324 );
@@ -337,6 +349,8 @@ void json_to_pbf_actions_joycon(JoyconContext& context, const JsonArray& history
337349 case NonNeutralControllerField::NONE:
338350 pbf_wait (context, Milliseconds (duration_in_ms));
339351 break ;
352+ default :
353+ throw ParseException (" Unexpected NonNeutralControllerField enum." );
340354 }
341355 }
342356 );
0 commit comments