0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-19 20:32:15 +02:00

UI: Fix crash when switching encoders in advanced mode

On linux, the JSON file handling code will try to read the directory
itself as a file, which can cause a crash.

Closes jp9000/obs-studio#681
This commit is contained in:
cryptonaut 2016-11-02 18:31:50 -07:00 committed by jp9000
parent 9982581a4f
commit 21ab517ba9

View File

@ -1290,14 +1290,16 @@ OBSPropertiesView *OBSBasicSettings::CreateEncoderPropertyView(
obs_data_t *settings = obs_encoder_defaults(encoder);
OBSPropertiesView *view;
char encoderJsonPath[512];
int ret = GetProfilePath(encoderJsonPath, sizeof(encoderJsonPath),
path);
if (ret > 0) {
obs_data_t *data = obs_data_create_from_json_file_safe(
encoderJsonPath, "bak");
obs_data_apply(settings, data);
obs_data_release(data);
if (path) {
char encoderJsonPath[512];
int ret = GetProfilePath(encoderJsonPath,
sizeof(encoderJsonPath), path);
if (ret > 0) {
obs_data_t *data = obs_data_create_from_json_file_safe(
encoderJsonPath, "bak");
obs_data_apply(settings, data);
obs_data_release(data);
}
}
view = new OBSPropertiesView(settings, encoder,