From f89117b5cf36797b04291942b2f2494895fc58dd Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 4 Nov 2022 11:02:04 +0100 Subject: Matrix: fix nullptr crash when room avatar is changed --- src/ResourceLoader.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/ResourceLoader.cpp') diff --git a/src/ResourceLoader.cpp b/src/ResourceLoader.cpp index 401ca38..e5d16dd 100644 --- a/src/ResourceLoader.cpp +++ b/src/ResourceLoader.cpp @@ -43,12 +43,10 @@ namespace QuickMedia { std::string output; const char *args[] = { "fc-match", font_name.c_str(), "file", nullptr }; - if(exec_program(args, accumulate_string, &output) == 0 && output.size() > 6 && output.size() >= font_name.size()) { + if(exec_program(args, accumulate_string, &output) == 0 && output.size() > 6) { output = strip(output); - if(string_ends_with(output, "/" + font_name)) { - font_filepath_result = output.substr(6); - return true; - } + font_filepath_result = output.substr(6); + return true; } fprintf(stderr, "Warning: failed to find font: %s\n", font_name.c_str()); -- cgit v1.2.3