1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

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

This commit is contained in:
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

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)}
}