osd: another shitty pointless UB

The pointer could be NULL if the number of bytes to copy was 0. In a
sane world, this would be fine, but not the current world.
This commit is contained in:
wm4 2018-10-14 15:51:36 +02:00 committed by Anton Kindestam
parent af9722cd3e
commit 32385a784c
1 changed files with 4 additions and 2 deletions

View File

@ -217,8 +217,10 @@ void osd_set_progbar(struct osd_state *osd, struct osd_progbar_state *s)
osd_obj->progbar_state.value = s->value;
osd_obj->progbar_state.num_stops = s->num_stops;
MP_TARRAY_GROW(osd_obj, osd_obj->progbar_state.stops, s->num_stops);
memcpy(osd_obj->progbar_state.stops, s->stops,
sizeof(osd_obj->progbar_state.stops[0]) * s->num_stops);
if (s->num_stops) {
memcpy(osd_obj->progbar_state.stops, s->stops,
sizeof(osd_obj->progbar_state.stops[0]) * s->num_stops);
}
osd_obj->osd_changed = true;
osd->want_redraw_notification = true;
pthread_mutex_unlock(&osd->lock);