Fixup dd79338c: avoid hypothetical division by zero

Spotted by Coverity.
This commit is contained in:
Jean-Marc Lasgouttes 2018-05-29 15:18:01 +02:00
parent c76b8b3a25
commit d1d3f75548

View File

@ -220,7 +220,7 @@ public:
} }
// The longest line in the reference font (for English) // The longest line in the reference font (for English)
// is 180. Calculate scale factor from that. // is 180. Calculate scale factor from that.
double const wscale = (180.0 / wline); double const wscale = wline > 0 ? (180.0 / wline) : 1;
// Now do the same for the height (necessary for condensed fonts) // Now do the same for the height (necessary for condensed fonts)
double const hscale = (34.0 / hline); double const hscale = (34.0 / hline);
// take the lower of the two scale factors. // take the lower of the two scale factors.