aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-11-04 11:02:04 +0100
committerdec05eba <dec05eba@protonmail.com>2022-11-04 11:02:04 +0100
commitf89117b5cf36797b04291942b2f2494895fc58dd (patch)
treef04f11b6c6a0bebea7e628a8426ab2c7fd3b922a /src
parent6e0948afb1bf1504b00601ff195c9fb05e9f2c1c (diff)
Matrix: fix nullptr crash when room avatar is changed
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp2
-rw-r--r--src/ResourceLoader.cpp8
2 files changed, 4 insertions, 6 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 856ff82..e31b846 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -5527,7 +5527,7 @@ namespace QuickMedia {
if(room_info.avatar_url) {
room_avatar_sprite.set_texture(nullptr);
- room_avatar_thumbnail_data.reset();
+ room_avatar_thumbnail_data = std::make_shared<ThumbnailData>();
avatar_applied = false;
}
});
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());