From 95a7496edca2f4cffcb1e01dfa351cb0a42f07c2 Mon Sep 17 00:00:00 2001 From: Bert Münnich Date: Mon, 1 Sep 2014 20:40:17 +0200 Subject: Fixed segfault in ci_toggle_animation, fixes issue #173 --- commands.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'commands.c') diff --git a/commands.c b/commands.c index 8fb3296..75cb101 100644 --- a/commands.c +++ b/commands.c @@ -290,13 +290,14 @@ bool ci_toggle_animation(arg_t a) { bool dirty = false; - img.multi.animate = !img.multi.animate; - - if (img.multi.animate) { - dirty = img_frame_animate(&img, true); - set_timeout(animate, img.multi.frames[img.multi.sel].delay, true); - } else { - reset_timeout(animate); + if (img.multi.cnt > 0) { + img.multi.animate = !img.multi.animate; + if (img.multi.animate) { + dirty = img_frame_animate(&img, true); + set_timeout(animate, img.multi.frames[img.multi.sel].delay, true); + } else { + reset_timeout(animate); + } } return dirty; } -- cgit v1.2.3-54-g00ecf