Explorar o código

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.)
Lain %!s(int64=2) %!d(string=hai) anos
pai
achega
b8d85d84a4
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      UI/window-basic-settings-stream.cpp

+ 1 - 1
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";