dont crash immediately if gif pixbufloader doesnt exist

This commit is contained in:
ouwou
2021-12-12 23:59:57 -05:00
parent c9647f9b33
commit 72935b0558

View File

@@ -25,16 +25,16 @@ ChatInputIndicator::ChatInputIndicator()
if (!std::filesystem::exists(path)) return;
auto gif_data = ReadWholeFile(path);
auto loader = Gdk::PixbufLoader::create();
loader->signal_size_prepared().connect([&](int inw, int inh) {
int w, h;
GetImageDimensions(inw, inh, w, h, 20, 10);
loader->set_size(w, h);
});
loader->write(gif_data.data(), gif_data.size());
try {
loader->signal_size_prepared().connect([&](int inw, int inh) {
int w, h;
GetImageDimensions(inw, inh, w, h, 20, 10);
loader->set_size(w, h);
});
loader->write(gif_data.data(), gif_data.size());
loader->close();
m_img.property_pixbuf_animation() = loader->get_animation();
} catch (const std::exception &) {}
} catch (...) {}
}
void ChatInputIndicator::AddUser(Snowflake channel_id, const UserData &user, int timeout) {