Explorar o código

Fix error types

Dennis Dervisis %!s(int64=6) %!d(string=hai) anos
pai
achega
bf5357019b
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      src/Materials/Textures/equiRectangularCubeTexture.ts

+ 4 - 2
src/Materials/Textures/equiRectangularCubeTexture.ts

@@ -92,7 +92,7 @@ export class EquiRectangularCubeTexture extends BaseTexture {
     /**
      * Load the image data, by putting the image on a canvas and extracting its buffer.
      */
-    private loadImage(loadTextureCallback: () => void, onError: (message?: string, exception?: any) => void): void {
+    private loadImage(loadTextureCallback: () => void, onError: Nullable<(message?: string, exception?: any) => void>): void {
         const canvas = document.createElement('canvas');
         const image = new Image();
 
@@ -112,7 +112,9 @@ export class EquiRectangularCubeTexture extends BaseTexture {
             loadTextureCallback();
         });
         image.addEventListener('error', (error) => {
-            onError(`${this.getClassName()} could not be loaded`, error);
+            if (onError) {
+                onError(`${this.getClassName()} could not be loaded`, error);
+            }
         });
         image.src = this.url;
     }