Skip to content

Commit

Permalink
Fix #2153: crash in MP lobby chat with low horizontal window size
Browse files Browse the repository at this point in the history
[size_lock] could cause layout_exception_width_modified while shrinking
the widget, and it didn't catch the exception. Now it does.
  • Loading branch information
jyrkive committed Nov 15, 2017
1 parent 506ee85 commit 7d1991a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/gui/widgets/size_lock.cpp
Expand Up @@ -17,6 +17,7 @@
#include "size_lock.hpp"

#include <gettext.hpp>
#include <gui/core/layout_exception.hpp>
#include <gui/core/register_widget.hpp>
#include <gui/widgets/helper.hpp>
#include <gui/widgets/settings.hpp>
Expand Down Expand Up @@ -45,7 +46,20 @@ void size_lock::place(const point& origin, const point& size)

if (content_size.y > size.y)
{
reduce_height(size.y);
try
{
reduce_height(size.y);
}
catch(layout_exception_width_modified&)
{
}

content_size = widget_->get_best_size();
}

if (content_size.x > size.x)
{
reduce_width(size.x);
content_size = widget_->get_best_size();
}

Expand Down

0 comments on commit 7d1991a

Please sign in to comment.