瀏覽代碼

libobs: Fix crash when no context

If obs was shutting down in very early in initialization like when the
X11 display is missing this context parameter might still be NULL.
Return early to allow shutdown to complete without crashing.
Kurt Kartaltepe 4 年之前
父節點
當前提交
9525943bc0
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      libobs/obs-nix-x11.c

+ 2 - 0
libobs/obs-nix-x11.c

@@ -846,6 +846,8 @@ static bool obs_nix_x11_hotkeys_platform_init(struct obs_core_hotkeys *hotkeys)
 static void obs_nix_x11_hotkeys_platform_free(struct obs_core_hotkeys *hotkeys)
 static void obs_nix_x11_hotkeys_platform_free(struct obs_core_hotkeys *hotkeys)
 {
 {
 	obs_hotkeys_platform_t *context = hotkeys->platform_context;
 	obs_hotkeys_platform_t *context = hotkeys->platform_context;
+	if (!context)
+		return;
 
 
 	for (size_t i = 0; i < OBS_KEY_LAST_VALUE; i++)
 	for (size_t i = 0; i < OBS_KEY_LAST_VALUE; i++)
 		da_free(context->keycodes[i].list);
 		da_free(context->keycodes[i].list);