GUI: fix possible division by zero

This commit is contained in:
tildearrow 2023-06-02 14:06:25 -05:00
parent 827a0074ba
commit 8c10c7ed5d

View file

@ -6209,9 +6209,14 @@ bool FurnaceGUI::init() {
// special consideration for Wayland // special consideration for Wayland
if (settings.dpiScale<0.5f) { if (settings.dpiScale<0.5f) {
if (strcmp(videoBackend,"wayland")==0) { if (strcmp(videoBackend,"wayland")==0) {
if (scrW<1) {
logW("screen width is zero!\n");
dpiScale=1.0;
} else {
dpiScale=(double)canvasW/(double)scrW; dpiScale=(double)canvasW/(double)scrW;
} }
} }
}
IMGUI_CHECKVERSION(); IMGUI_CHECKVERSION();
ImGui::CreateContext(); ImGui::CreateContext();