Browse Source

UI/importers: Ignore empty Streamlabs hotkeys

Ignore empty hotkeys when importing a scene collection file from
Streamlabs Desktop.
prgmitchell 2 years ago
parent
commit
2a9b9c9298
1 changed files with 7 additions and 0 deletions
  1. 7 0
      UI/importers/sl.cpp

+ 7 - 0
UI/importers/sl.cpp

@@ -22,6 +22,10 @@ using namespace json11;
 
 static string translate_key(const string &sl_key)
 {
+	if (sl_key.empty()) {
+		return "IGNORE";
+	}
+
 	if (sl_key.substr(0, 6) == "Numpad" && sl_key.size() == 7) {
 		return "OBS_KEY_NUM" + sl_key.substr(6);
 	} else if (sl_key.substr(0, 3) == "Key") {
@@ -172,6 +176,9 @@ static void get_hotkey_bindings(Json::object &out_hotkeys,
 			string key =
 				translate_key(binding["key"].string_value());
 
+			if (key == "IGNORE")
+				continue;
+
 			out_hotkey.push_back(
 				Json::object{{"control", modifiers["ctrl"]},
 					     {"shift", modifiers["shift"]},