gg: ensure window_size does not do / 0 (#8907)

pull/8908/head
R cqls 2021-02-22 18:00:10 +01:00 committed by GitHub
parent 8033203ef6
commit 68972fcec6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -761,7 +761,10 @@ pub fn screen_size() Size {
// window_size returns the `Size` of the active window
pub fn window_size() Size {
s := sapp.dpi_scale()
mut s := sapp.dpi_scale()
if s == 0 {
s = 1.
}
return Size{int(sapp.width() / s), int(sapp.height() / s)}
}