Skip to content

Commit 4d3c2e3

Browse files
fix: initialize variables to prevent potentially uninitialized usage
Fixed compiler warnings about potentially uninitialized variables in handle_key_down and hkm_unregister functions by adding else clauses to set default empty string values.
1 parent ddbb7bf commit 4d3c2e3

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packages/hotkey_manager_linux/linux/hotkey_manager_linux_plugin.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ void handle_key_down(const char* keystring, void* user_data) {
4040

4141
if (result != hotkey_id_map.end())
4242
identifier = result->first.c_str();
43+
else
44+
identifier = "";
4345

4446
g_autoptr(FlValue) event_data = fl_value_new_map();
4547
fl_value_set_string_take(event_data, "identifier",
@@ -111,6 +113,8 @@ static FlMethodResponse* hkm_unregister(_HotkeyManagerLinuxPlugin* self,
111113

112114
if (result != hotkey_id_map.end())
113115
keystring = result->second.c_str();
116+
else
117+
keystring = "";
114118

115119
keybinder_unbind(keystring, handle_key_down);
116120
hotkey_id_map.erase(identifier);

0 commit comments

Comments
 (0)