Fix lovr.graphics.getPixelDensity when widths are zero;

This commit is contained in:
bjorn 2019-02-07 11:59:48 -08:00
parent 6f20126020
commit d12d185e6c
1 changed files with 5 additions and 1 deletions

View File

@ -217,7 +217,11 @@ float lovrGraphicsGetPixelDensity() {
int width, framebufferWidth;
lovrPlatformGetWindowSize(&width, NULL);
lovrPlatformGetFramebufferSize(&framebufferWidth, NULL);
return (float) framebufferWidth / (float) width;
if (width == 0 || framebufferWidth == 0) {
return 0.f;
} else {
return (float) framebufferWidth / (float) width;
}
}
void lovrGraphicsSetCamera(Camera* camera, bool clear) {