Browse Source

fix for invalid context in hide

Nicolas Cannasse 4 years ago
parent
commit
7989fa81e0
1 changed files with 7 additions and 0 deletions
  1. 7 0
      hxd/fs/LocalFileSystem.hx

+ 7 - 0
hxd/fs/LocalFileSystem.hx

@@ -74,8 +74,15 @@ class LocalEntry extends FileEntry {
 
 	override function loadBitmap( onLoaded : hxd.fs.LoadedBitmap -> Void ) : Void {
 		#if js
+		#if (multidriver && !macro)
+		var engine = h3d.Engine.getCurrent(); // hide
+		#end
 		var image = new js.html.Image();
 		image.onload = function(_) {
+			#if (multidriver && !macro)
+			if( engine.driver == null ) return;
+			engine.setCurrent();
+			#end
 			onLoaded(new LoadedBitmap(image));
 		};
 		image.src = "file://"+file;