diff --git a/src/image/loading_displaying.js b/src/image/loading_displaying.js index f257b2a0d3..369b137b70 100644 --- a/src/image/loading_displaying.js +++ b/src/image/loading_displaying.js @@ -303,6 +303,9 @@ p5.prototype.saveGif = async function( if (typeof duration !== 'number') { throw TypeError('Duration parameter must be a number'); } + if (duration <= 0) { + throw new Error('Duration parameter must be a positive number'); + } // extract variables for more comfortable use const delay = (options && options.delay) || 0; // in seconds