aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-04-11 01:59:52 +0200
committerdec05eba <dec05eba@protonmail.com>2022-04-11 01:59:52 +0200
commit56c05d5573c7145263ae35745c63818b5bb7a48d (patch)
tree5ede93d9521222828553e08f6e3b90c7322ac9a6 /src
parent6da71b830ead4b7ecb9a71e05dcd50c4abd3aa4f (diff)
Matrix: test fix crash with reaction renderer
Diffstat (limited to 'src')
-rw-r--r--src/Body.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/Body.cpp b/src/Body.cpp
index 2747a22..1451541 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -1491,9 +1491,11 @@ namespace QuickMedia {
float reaction_max_height = 0.0f;
for(int i = 0; i < (int)item->reactions.size(); ++i) {
auto &reaction = item->reactions[i];
- reaction.text->updateGeometry();
- reaction.size = { reaction.text->getWidth(), reaction.text->getHeight() };
- reaction.num_lines = reaction.text->getNumLines();
+ if(reaction.text) {
+ reaction.text->updateGeometry();
+ reaction.size = { reaction.text->getWidth(), reaction.text->getHeight() };
+ reaction.num_lines = reaction.text->getNumLines();
+ }
const float reaction_max_height_prev = reaction_max_height;
reaction_max_height = std::max(reaction_max_height, reaction.size.y);
reaction_background.set_size(mgl::vec2f(reaction.size.x + body_spacing[body_theme].reaction_background_padding_x * 2.0f, reaction.size.y + body_spacing[body_theme].reaction_background_padding_y * 2.0f));
@@ -1510,10 +1512,12 @@ namespace QuickMedia {
reaction_offset_x = new_reaction_offset_x;
}
- reaction.text->set_position(reaction_background.get_position() + mgl::vec2f(body_spacing[body_theme].reaction_background_padding_x, - 4.0f + body_spacing[body_theme].reaction_background_padding_y));
+ if(reaction.text) {
+ reaction.text->set_position(reaction_background.get_position() + mgl::vec2f(body_spacing[body_theme].reaction_background_padding_x, - 4.0f + body_spacing[body_theme].reaction_background_padding_y));
- reaction_background.draw(window);
- reaction.text->draw(window);
+ reaction_background.draw(window);
+ reaction.text->draw(window);
+ }
}
item_pos.y += reaction_max_height + body_spacing[body_theme].reaction_padding_y;
}