diff --git a/src/textdialog.cpp b/src/textdialog.cpp index 8ca2e3b..5c317af 100644 --- a/src/textdialog.cpp +++ b/src/textdialog.cpp @@ -80,7 +80,7 @@ void TextDialog::exec() { const int fontHeight = gmenu2x->font->getLineSpacing(); unsigned int contentY, contentHeight; tie(contentY, contentHeight) = gmenu2x->getContentArea(); - const unsigned rowsPerPage = contentHeight / fontHeight; + const unsigned rowsPerPage = max(contentHeight / fontHeight, 1u); const unsigned maxFirstRow = text.size() < rowsPerPage ? 0 : text.size() - rowsPerPage; contentY += (contentHeight % fontHeight) / 2; diff --git a/src/textmanualdialog.cpp b/src/textmanualdialog.cpp index 0632c0c..1b17a6c 100644 --- a/src/textmanualdialog.cpp +++ b/src/textmanualdialog.cpp @@ -92,7 +92,7 @@ void TextManualDialog::exec() { ss >> spagecount; string pageStatus; - const unsigned rowsPerPage = 180 / gmenu2x->font->getLineSpacing(); + const unsigned rowsPerPage = max(180u / gmenu2x->font->getLineSpacing(), 1u); unsigned page = 0, firstRow = 0; bool close = false;