gfx-effect-source: Check for effect == nullptr in test_for_updates

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2018-04-24 13:58:07 +02:00
parent 49964e15be
commit d8d60f7a21

View file

@ -62,13 +62,14 @@ void gfx::effect_source::video_tick_impl(float time) {
}
void gfx::effect_source::video_render_impl(gs_effect_t* parent_effect) {
parent_effect;
}
gfx::effect_source::effect_source(obs_data_t* data, obs_source_t* owner) {
m_source = owner;
time_existing = 0;
time_active = 0;
update(data);
}
gfx::effect_source::~effect_source() {}
@ -205,11 +206,10 @@ bool gfx::effect_source::test_for_updates(const char* text, const char* path) {
// If the shader is different, rebuild the parameter list.
if (is_shader_different) {
std::map<paramident_t, std::shared_ptr<parameter>> new_params;
if (shader.effect) {
// ToDo: Figure out if a recycling approach would work.
// Might improve stability in low memory situations.
std::map<paramident_t, std::shared_ptr<parameter>> new_params;
auto effect_param_list = shader.effect->get_parameters();
for (auto effect_param : effect_param_list) {
paramident_t ident;
@ -335,8 +335,10 @@ bool gfx::effect_source::test_for_updates(const char* text, const char* path) {
}
}
}
parameters = std::move(new_params);
} else {
parameters.clear();
}
}
return is_shader_different;