mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2024-12-05 00:38:00 +01:00
fix a potential division by zero in GetDefaultWindow(Width|Height)
This commit is contained in:
parent
a8f78ea9bb
commit
2b3a2e3d72
1 changed files with 2 additions and 2 deletions
|
@ -32,7 +32,7 @@
|
|||
|
||||
static char* GetDefaultWindowWidth(struct Game* game) {
|
||||
char* buf = malloc(sizeof(char) * 255);
|
||||
double aspect = game->_priv.params.aspect ? game->_priv.params.aspect : (game->_priv.params.width / (double)game->_priv.params.height);
|
||||
double aspect = game->_priv.params.aspect ? game->_priv.params.aspect : (game->_priv.params.height ? (game->_priv.params.width / (double)game->_priv.params.height) : 1.0);
|
||||
if (aspect < 1.0) {
|
||||
aspect = 1.0;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ static char* GetDefaultWindowWidth(struct Game* game) {
|
|||
|
||||
static char* GetDefaultWindowHeight(struct Game* game) {
|
||||
char* buf = malloc(sizeof(char) * 255);
|
||||
double aspect = game->_priv.params.aspect ? game->_priv.params.aspect : (game->_priv.params.width / (double)game->_priv.params.height);
|
||||
double aspect = game->_priv.params.aspect ? game->_priv.params.aspect : (game->_priv.params.height ? (game->_priv.params.width / (double)game->_priv.params.height) : 1.0);
|
||||
if (aspect > 1.0) {
|
||||
aspect = 1.0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue