diff --git a/src/image/loading_displaying.js b/src/image/loading_displaying.js index 1f5077989a..4b6a86a806 100644 --- a/src/image/loading_displaying.js +++ b/src/image/loading_displaying.js @@ -267,6 +267,9 @@ function loadingDisplaying(p5, fn){ if (typeof duration !== 'number') { throw TypeError('Duration parameter must be a number'); } + if (duration <= 0) { + throw TypeError('Duration parameter must be greater than 0'); + } // extract variables for more comfortable use const delay = (options && options.delay) || 0; // in seconds