From e5970e8095d5b3ab49f66967e8318cdced67ba1d Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Tue, 4 Oct 2016 08:35:08 -0400 Subject: [PATCH] prevent divide by zero --- tasks/task_save.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tasks/task_save.c b/tasks/task_save.c index bba0ac4662..1fad0bc0f9 100644 --- a/tasks/task_save.c +++ b/tasks/task_save.c @@ -726,7 +726,9 @@ static void task_load_handler(retro_task_t *task) bytes_read = filestream_read(state->file, (uint8_t*)state->data + state->bytes_read, remaining); state->bytes_read += bytes_read; - task->progress = (state->bytes_read / (float)state->size) * 100; + + if (state->size > 0) + task->progress = (state->bytes_read / (float)state->size) * 100; if (task->cancelled || bytes_read != remaining) {