Commit 0a0bb185 authored by Kurt Hindenburg's avatar Kurt Hindenburg
Browse files

Fix crashing by checking for fontMetrics().maxWidth() == 0

On MacOS there are issues with QFontMetrics.maxWidth returning 0; in
that case find max character width manually.

Approved by Eike Hein on IRC
(cherry picked from commit 66864dfe)
parent 8d99ae00
......@@ -245,6 +245,13 @@ namespace Konversation
maxPixels -= fontMetrics().width("...");
int len, delta;
// On some MacOS system, maxWidth may return 0
if (em == 0) {
foreach (const QChar &c, text) {
em = qMax(em, fontMetrics().width(c));
}
}
while((tw > maxPixels) && !tmp.isEmpty())
{
len = tmp.length();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment