mirror of https://github.com/Xaymar/obs-StreamFX
filter-displacement: Fix crash on nullptr file path
This commit is contained in:
parent
0c447f4055
commit
9db7cd8da2
|
@ -118,12 +118,10 @@ obs_properties_t* filter::displacement::displacement_factory::get_properties(voi
|
||||||
if (ptr)
|
if (ptr)
|
||||||
path = reinterpret_cast<displacement_instance*>(ptr)->get_file();
|
path = reinterpret_cast<displacement_instance*>(ptr)->get_file();
|
||||||
|
|
||||||
obs_properties_add_path(pr, ST_FILE, D_TRANSLATE(ST_FILE),
|
obs_properties_add_path(pr, ST_FILE, D_TRANSLATE(ST_FILE), obs_path_type::OBS_PATH_FILE, D_TRANSLATE(ST_FILE_TYPES),
|
||||||
obs_path_type::OBS_PATH_FILE, D_TRANSLATE(ST_FILE_TYPES), path.c_str());
|
path.c_str());
|
||||||
obs_properties_add_float_slider(pr, ST_RATIO, D_TRANSLATE(ST_RATIO), 0, 1,
|
obs_properties_add_float_slider(pr, ST_RATIO, D_TRANSLATE(ST_RATIO), 0, 1, 0.01);
|
||||||
0.01);
|
obs_properties_add_float_slider(pr, ST_SCALE, D_TRANSLATE(ST_SCALE), -1000, 1000, 0.01);
|
||||||
obs_properties_add_float_slider(pr, ST_SCALE, D_TRANSLATE(ST_SCALE), -1000,
|
|
||||||
1000, 0.01);
|
|
||||||
return pr;
|
return pr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,13 +200,15 @@ filter::displacement::displacement_instance::displacement_instance(obs_data_t* d
|
||||||
: _self(context), _timer(0), _effect(nullptr), _distance(0), _file_create_time(0), _file_modified_time(0),
|
: _self(context), _timer(0), _effect(nullptr), _distance(0), _file_create_time(0), _file_modified_time(0),
|
||||||
_file_size(0)
|
_file_size(0)
|
||||||
{
|
{
|
||||||
char* effectFile = obs_module_file("effects/displace._effect");
|
char* effectFile = obs_module_file("effects/displace.effect");
|
||||||
|
if (effectFile) {
|
||||||
try {
|
try {
|
||||||
_effect = std::make_shared<gs::effect>(effectFile);
|
_effect = std::make_shared<gs::effect>(effectFile);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
P_LOG_ERROR("<Displacement Filter:%s> Failed to load displacement _effect.", obs_source_get_name(_self));
|
P_LOG_ERROR("<Displacement Filter:%s> Failed to load displacement effect.", obs_source_get_name(_self));
|
||||||
}
|
}
|
||||||
bfree(effectFile);
|
bfree(effectFile);
|
||||||
|
}
|
||||||
|
|
||||||
update(data);
|
update(data);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue