diff options
| author | 2016-07-23 19:37:12 +0200 | |
|---|---|---|
| committer | 2016-07-23 21:02:05 +0200 | |
| commit | 7331b790217f9a3e86e5668cb134bd8f073ff289 (patch) | |
| tree | 30ab146daeb3669ecf2f27f948bd6dc971d78a22 /src/common/emu_window.cpp | |
| parent | Merge pull request #1963 from wwylele/rtc (diff) | |
| download | yuzu-7331b790217f9a3e86e5668cb134bd8f073ff289.tar.gz yuzu-7331b790217f9a3e86e5668cb134bd8f073ff289.tar.xz yuzu-7331b790217f9a3e86e5668cb134bd8f073ff289.zip | |
Protection against a resize of size 0
Diffstat (limited to 'src/common/emu_window.cpp')
| -rw-r--r-- | src/common/emu_window.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/common/emu_window.cpp b/src/common/emu_window.cpp index 08270dd88..fd728c109 100644 --- a/src/common/emu_window.cpp +++ b/src/common/emu_window.cpp | |||
| @@ -51,7 +51,6 @@ static bool IsWithinTouchscreen(const EmuWindow::FramebufferLayout& layout, unsi | |||
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | std::tuple<unsigned,unsigned> EmuWindow::ClipToTouchScreen(unsigned new_x, unsigned new_y) { | 53 | std::tuple<unsigned,unsigned> EmuWindow::ClipToTouchScreen(unsigned new_x, unsigned new_y) { |
| 54 | |||
| 55 | new_x = std::max(new_x, framebuffer_layout.bottom_screen.left); | 54 | new_x = std::max(new_x, framebuffer_layout.bottom_screen.left); |
| 56 | new_x = std::min(new_x, framebuffer_layout.bottom_screen.right-1); | 55 | new_x = std::min(new_x, framebuffer_layout.bottom_screen.right-1); |
| 57 | 56 | ||
| @@ -92,9 +91,9 @@ void EmuWindow::TouchMoved(unsigned framebuffer_x, unsigned framebuffer_y) { | |||
| 92 | } | 91 | } |
| 93 | 92 | ||
| 94 | EmuWindow::FramebufferLayout EmuWindow::FramebufferLayout::DefaultScreenLayout(unsigned width, unsigned height) { | 93 | EmuWindow::FramebufferLayout EmuWindow::FramebufferLayout::DefaultScreenLayout(unsigned width, unsigned height) { |
| 95 | 94 | // When hiding the widget, the function receives a size of 0 | |
| 96 | ASSERT(width > 0); | 95 | if (width == 0) width = 1; |
| 97 | ASSERT(height > 0); | 96 | if (height == 0) height = 1; |
| 98 | 97 | ||
| 99 | EmuWindow::FramebufferLayout res = { width, height, {}, {} }; | 98 | EmuWindow::FramebufferLayout res = { width, height, {}, {} }; |
| 100 | 99 | ||