diff options
| author | Eli Zaretskii | 2026-03-02 17:03:17 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2026-03-02 17:03:17 +0200 |
| commit | f46eaf609e1f9344671a7886f161d460edc0fe0c (patch) | |
| tree | fef631be44cceff1f1f6f054f25d8f293801ba64 /src | |
| parent | b3c0aee42b086af4b3c6e26da1a5d81490b6128b (diff) | |
| download | emacs-f46eaf609e1f9344671a7886f161d460edc0fe0c.tar.gz emacs-f46eaf609e1f9344671a7886f161d460edc0fe0c.zip | |
; * src/w32image.c (w32_gdip_export_frame): Add error checking.
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32image.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/w32image.c b/src/w32image.c index 36d259a07c2..f0838fd0aba 100644 --- a/src/w32image.c +++ b/src/w32image.c | |||
| @@ -580,9 +580,13 @@ w32_gdip_export_frame (HWND hwnd, Lisp_Object file, CLSID *clsid) | |||
| 580 | made visible, in which case users might want them in the image. | 580 | made visible, in which case users might want them in the image. |
| 581 | The downside is that the image has some of the desktop around the | 581 | The downside is that the image has some of the desktop around the |
| 582 | frame included in it. So what? */ | 582 | frame included in it. So what? */ |
| 583 | GetWindowRect (hwnd, &frame_rect); | 583 | if (!GetWindowRect (hwnd, &frame_rect)) |
| 584 | return -1; | ||
| 584 | frame_width = frame_rect.right - frame_rect.left; | 585 | frame_width = frame_rect.right - frame_rect.left; |
| 585 | frame_height = frame_rect.bottom - frame_rect.top; | 586 | frame_height = frame_rect.bottom - frame_rect.top; |
| 587 | if (!(frame_width > 0 && frame_height > 0)) | ||
| 588 | return -1; | ||
| 589 | |||
| 586 | hdc = GetWindowDC (hwnd); | 590 | hdc = GetWindowDC (hwnd); |
| 587 | bits_per_pixel = GetDeviceCaps (hdc, BITSPIXEL); | 591 | bits_per_pixel = GetDeviceCaps (hdc, BITSPIXEL); |
| 588 | capture_hdc = CreateCompatibleDC (hdc); | 592 | capture_hdc = CreateCompatibleDC (hdc); |