]> git.lyx.org Git - features.git/commitdiff
Fixup dd79338c: avoid hypothetical division by zero
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 29 May 2018 13:18:01 +0000 (15:18 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 29 May 2018 13:18:01 +0000 (15:18 +0200)
Spotted by Coverity.

src/frontends/qt4/GuiView.cpp

index 47a56882b15bdfeedbf7bade829ea9343d4fd315..435738957ccdd1cdef51df43371dae53fe01d060 100644 (file)
@@ -220,7 +220,7 @@ public:
                }
                // The longest line in the reference font (for English)
                // 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)
                double const hscale = (34.0 / hline);
                // take the lower of the two scale factors.