Skip to content

Commit

Permalink
UI: Fix null pointer dereference
Browse files Browse the repository at this point in the history
strcmp(obs_get_encoder_codec(option), "opus") causes the application to
segfault while loading service if find_encoder(id) returns NULL. Add a
null pointer check to prevent that from occurring.
  • Loading branch information
CrackThrough authored and Lain-B committed Jan 31, 2024
1 parent 10c82e6 commit 7d25a80
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion UI/window-basic-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1431,7 +1431,9 @@ bool OBSBasic::LoadService()

option = config_get_string(basicConfig, "AdvOut",
"AudioEncoder");
if (strcmp(obs_get_encoder_codec(option), "opus") != 0)

const char *encoder_codec = obs_get_encoder_codec(option);
if (!encoder_codec || strcmp(encoder_codec, "opus") != 0)
config_set_string(basicConfig, "AdvOut", "AudioEncoder",
"ffmpeg_opus");
}
Expand Down

0 comments on commit 7d25a80

Please sign in to comment.