Skip to content

Commit e618d3d

Browse files
committed
Fix crash when taking a screenshot right after video reinit
1 parent 53f90ba commit e618d3d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tasks/task_screenshot.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ static bool screenshot_dump_direct(screenshot_task_state_t *state)
9393
bool ret = false;
9494

9595
#if defined(HAVE_RPNG)
96+
const uint8_t* input = (const uint8_t*)state->frame + ((int)state->height - 1) * state->pitch;
97+
98+
if (!input)
99+
return ret;
100+
96101
if (state->flags & SS_TASK_FLAG_BGR24)
97102
scaler->in_fmt = SCALER_FMT_BGR24;
98103
else if (state->pixel_format_type == RETRO_PIXEL_FORMAT_XRGB8888)
@@ -193,7 +198,13 @@ static void task_screenshot_handler(retro_task_t *task)
193198
const char *_msg = msg_hash_to_str(MSG_FAILED_TO_TAKE_SCREENSHOT);
194199
runloop_msg_queue_push(_msg, strlen(_msg), 1,
195200
(state->flags & SS_TASK_FLAG_IS_PAUSED) ? 1 : 180, true, NULL,
196-
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
201+
MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_ERROR);
202+
203+
#if defined(HAVE_GFX_WIDGETS)
204+
/* Do not show empty widget success on error */
205+
if (state)
206+
state->flags |= SS_TASK_FLAG_SILENCE;
207+
#endif
197208
}
198209

199210
if (task->title)

0 commit comments

Comments
 (0)