mirror of https://github.com/Genymobile/scrcpy
Avoid division by 0
If the frame_size width or height is 0, just return the current size to avoid calculations involving divison by 0.
This commit is contained in:
parent
27b9159b07
commit
d646f95a31
|
@ -88,6 +88,11 @@ static SDL_bool get_preferred_display_bounds(struct size *bounds) {
|
|||
// - it keeps the aspect ratio
|
||||
// - it scales down to make it fit in the display_size
|
||||
static struct size get_optimal_size(struct size current_size, struct size frame_size) {
|
||||
if (frame_size.width == 0 || frame_size.height == 0) {
|
||||
// avoid division by 0
|
||||
return current_size;
|
||||
}
|
||||
|
||||
struct size display_size;
|
||||
// 32 bits because we need to multiply two 16 bits values
|
||||
Uint32 w;
|
||||
|
|
Loading…
Reference in New Issue