glcd: fix possible division by zero

This commit is contained in:
Jacek Jendrzej
2020-09-14 15:18:07 +02:00
committed by Thilo Graf
parent 48aa42d346
commit 6526883922

View File

@@ -207,6 +207,7 @@ void cGLCD::Exec()
GLCD::cFont font_tmp; GLCD::cFont font_tmp;
int fw = font_epg.Width(Epg); int fw = font_epg.Width(Epg);
fw = (fw == 0) ? 1: fw;
font_tmp.LoadFT2(t.glcd_font, "UTF-8", fontsize_epg * bitmap->Width() / fw); font_tmp.LoadFT2(t.glcd_font, "UTF-8", fontsize_epg * bitmap->Width() / fw);
fw = font_tmp.Width(Epg); fw = font_tmp.Width(Epg);
int fh = font_tmp.Height(Epg); int fh = font_tmp.Height(Epg);