From 56f57e94a33d6e3e2d449de73968792c4cbc9320 Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Tue, 24 Oct 2017 07:53:59 -0700 Subject: [PATCH] Add additional guards to HTML5 AudioSource if buffer is null --- lime/_backend/html5/HTML5AudioSource.hx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lime/_backend/html5/HTML5AudioSource.hx b/lime/_backend/html5/HTML5AudioSource.hx index 2cf104d27..b95ef2bc0 100644 --- a/lime/_backend/html5/HTML5AudioSource.hx +++ b/lime/_backend/html5/HTML5AudioSource.hx @@ -85,7 +85,7 @@ class HTML5AudioSource { #if howlerjs playing = false; - parent.buffer.__srcHowl.pause (id); + if (parent.buffer != null) parent.buffer.__srcHowl.pause (id); #end @@ -97,7 +97,7 @@ class HTML5AudioSource { #if howlerjs playing = false; - parent.buffer.__srcHowl.stop (id); + if (parent.buffer != null) parent.buffer.__srcHowl.stop (id); #end @@ -160,7 +160,7 @@ class HTML5AudioSource { return getLength (); - } else { + } else if (parent.buffer != null) { var time = Std.int (parent.buffer.__srcHowl.seek (id) * 1000) - parent.offset; if (time < 0) return 0; @@ -168,12 +168,10 @@ class HTML5AudioSource { } - #else + #end return 0; - #end - } @@ -231,14 +229,16 @@ class HTML5AudioSource { #if howlerjs - return Std.int (parent.buffer.__srcHowl.duration () * 1000); - - #else - - return 0; + if (parent.buffer != null) { + + return Std.int (parent.buffer.__srcHowl.duration () * 1000); + + } #end + return 0; + }