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:
parent
9982581a4f
commit
21ab517ba9
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user