Просмотр исходного кода

UI: Don't read unloaded module in source toolbar

Avoid potential crashes similar to #4391 for existing users,
especially on non-Windows.
Matt Gajownik 4 лет назад
Родитель
Сommit
4e04011101
1 измененных файлов с 6 добавлено и 0 удалено
  1. 6 0
      UI/context-bar-controls.cpp

+ 6 - 0
UI/context-bar-controls.cpp

@@ -323,6 +323,9 @@ DeviceCaptureToolbar::DeviceCaptureToolbar(QWidget *parent, OBSSource source)
 	active = obs_data_get_bool(settings, "active");
 
 	obs_module_t *mod = obs_get_module("win-dshow");
+	if (!mod)
+		return;
+
 	activateText = obs_module_get_locale_text(mod, "Activate");
 	deactivateText = obs_module_get_locale_text(mod, "Deactivate");
 
@@ -373,6 +376,9 @@ GameCaptureToolbar::GameCaptureToolbar(QWidget *parent, OBSSource source)
 	ui->setupUi(this);
 
 	obs_module_t *mod = obs_get_module("win-capture");
+	if (!mod)
+		return;
+
 	ui->modeLabel->setText(obs_module_get_locale_text(mod, "Mode"));
 	ui->windowLabel->setText(
 		obs_module_get_locale_text(mod, "WindowCapture.Window"));