From b8d85d84a446f0ac8ad9f0d9ec76f4bd672ee8df Mon Sep 17 00:00:00 2001 From: Lain Date: Thu, 17 Aug 2023 17:06:24 -0700 Subject: [PATCH] UI: Fix potential null pointer dereference If you're using an encoder from a plugin, and you remove that plugin, this value will be null, causing a crash. (Lain note: I realize that this isn't the best solution to this problem, though there really isn't any way to infer what type of encoder the prior encoder was. Should also save the encoder type as additional setting metadata in future versions.) --- UI/window-basic-settings-stream.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UI/window-basic-settings-stream.cpp b/UI/window-basic-settings-stream.cpp index 7c452cc23..c9f015587 100644 --- a/UI/window-basic-settings-stream.cpp +++ b/UI/window-basic-settings-stream.cpp @@ -1441,7 +1441,7 @@ static QString get_adv_audio_fallback(const QString &enc) { const char *codec = obs_get_encoder_codec(QT_TO_UTF8(enc)); - if (strcmp(codec, "aac") == 0) + if (codec && strcmp(codec, "aac") == 0) return "ffmpeg_opus"; QString aac_default = "ffmpeg_aac";