added checks to mitigate floating point crashes

This commit is contained in:
fourtf
2020-04-19 21:05:40 +02:00
parent 6b512d1052
commit 6052846bc3
12 changed files with 74 additions and 40 deletions
+3 -1
View File
@@ -9,6 +9,7 @@
#include <QIcon>
#include <QLayout>
#include <QtGlobal>
#include <algorithm>
namespace chatterino {
@@ -113,7 +114,8 @@ float BaseWidget::qtFontScale() const
{
if (auto window = dynamic_cast<BaseWindow *>(this->window()))
{
return this->scale() / window->nativeScale_;
// ensure no div by 0
return this->scale() / std::max<float>(0.01f, window->nativeScale_);
}
else
{