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
+4 -2
View File
@@ -93,10 +93,12 @@ void Label::paintEvent(QPaintEvent *)
QFontMetrics metrics = getFonts()->getFontMetrics(
this->getFontStyle(),
this->scale() * 96.f / this->logicalDpiX() * deviceDpi);
this->scale() * 96.f /
std::max<float>(0.01, this->logicalDpiX() * deviceDpi));
painter.setFont(getFonts()->getFont(
this->getFontStyle(),
this->scale() * 96.f / this->logicalDpiX() * deviceDpi));
this->scale() * 96.f /
std::max<float>(0.02, this->logicalDpiX() * deviceDpi)));
int offset = this->getOffset();