浏览代码

[X11] Fix `keyboard_get_label_from_physical` errors when used on key without label.

Pāvels Nadtočajevs 2 月之前
父节点
当前提交
cf21565c77
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5 2
      platform/linuxbsd/x11/display_server_x11.cpp

+ 5 - 2
platform/linuxbsd/x11/display_server_x11.cpp

@@ -3746,8 +3746,11 @@ Key DisplayServerX11::keyboard_get_label_from_physical(Key p_keycode) const {
 	Key key = KeyMappingX11::get_keycode(xkeysym);
 	Key key = KeyMappingX11::get_keycode(xkeysym);
 #ifdef XKB_ENABLED
 #ifdef XKB_ENABLED
 	if (xkb_loaded_v08p) {
 	if (xkb_loaded_v08p) {
-		String keysym = String::chr(xkb_keysym_to_utf32(xkb_keysym_to_upper(xkeysym)));
-		key = fix_key_label(keysym[0], KeyMappingX11::get_keycode(xkeysym));
+		char32_t chr = xkb_keysym_to_utf32(xkb_keysym_to_upper(xkeysym));
+		if (chr != 0) {
+			String keysym = String::chr(chr);
+			key = fix_key_label(keysym[0], KeyMappingX11::get_keycode(xkeysym));
+		}
 	}
 	}
 #endif
 #endif