From f5b4c1f7a1b6bef914e2e9624a6ae3b48ed8b49d Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Sun, 4 Aug 2019 23:20:35 +0200 Subject: [PATCH] filter-color-grade: Fix crash if color-grade.effect is missing --- source/filters/filter-color-grade.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/source/filters/filter-color-grade.cpp b/source/filters/filter-color-grade.cpp index 3255c0c5..8ef4a5a5 100644 --- a/source/filters/filter-color-grade.cpp +++ b/source/filters/filter-color-grade.cpp @@ -375,13 +375,17 @@ filter::color_grade::color_grade_instance::color_grade_instance(obs_data_t* data { char* file = obs_module_file("effects/color-grade.effect"); - try { - _effect = gs::effect::create(file); - bfree(file); - } catch (std::runtime_error& ex) { - P_LOG_ERROR(" Loading _effect '%s' failed with error(s): %s", file, ex.what()); - bfree(file); - throw ex; + if (file) { + try { + _effect = gs::effect::create(file); + bfree(file); + } catch (std::runtime_error& ex) { + P_LOG_ERROR(" Loading _effect '%s' failed with error(s): %s", file, ex.what()); + bfree(file); + throw ex; + } + } else { + throw std::runtime_error("Missing file color-grade.effect."); } } {