aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp6
-rw-r--r--src/plugins/Matrix.cpp4
2 files changed, 5 insertions, 5 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index ca3cedb..6c3bc34 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -1945,9 +1945,9 @@ namespace QuickMedia {
image_path.join(std::to_string(image_index + 1));
if(get_file_type(image_path) == FileType::REGULAR) {
- std::string image_data;
- if(file_get_content(image_path, image_data) == 0) {
- if(image_texture.loadFromMemory(image_data.data(), image_data.size())) {
+ sf::Image image;
+ if(image.loadFromFile(image_path.data)) {
+ if(image_texture.loadFromImage(image)) {
image_texture.setSmooth(true);
//image_texture.generateMipmap();
return LoadImageResult::OK;
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 8ef7f47..d4fdd03 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -411,8 +411,8 @@ namespace QuickMedia {
user_info->avatar_url = std::move(avatar_url_str);
if(strncmp(user_info->avatar_url.c_str(), "mxc://", 6) == 0)
user_info->avatar_url.erase(user_info->avatar_url.begin(), user_info->avatar_url.begin() + 6);
- // TODO: What if the user hasn't selected an avatar?
- user_info->avatar_url = homeserver + "/_matrix/media/r0/thumbnail/" + user_info->avatar_url + "?width=32&height=32&method=crop";
+ if(!user_info->avatar_url.empty())
+ user_info->avatar_url = homeserver + "/_matrix/media/r0/thumbnail/" + user_info->avatar_url + "?width=32&height=32&method=crop";
user_info->display_name = display_name_json.asString();
user_info->display_name_color = user_id_to_color(sender_json_str);