From 05bf9248975ed1ee16c4690e38de30dd078a683b Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Tue, 30 Aug 2016 22:54:46 +0200 Subject: [PATCH] Check if region is null before property assignment. --- spine-ts/core/src/TextureAtlasAttachmentLoader.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spine-ts/core/src/TextureAtlasAttachmentLoader.ts b/spine-ts/core/src/TextureAtlasAttachmentLoader.ts index a8cc823a3..9a2040a07 100644 --- a/spine-ts/core/src/TextureAtlasAttachmentLoader.ts +++ b/spine-ts/core/src/TextureAtlasAttachmentLoader.ts @@ -40,8 +40,8 @@ module spine { /** @return May be null to not load an attachment. */ newRegionAttachment (skin: Skin, name: string, path: string): RegionAttachment { let region = this.atlas.findRegion(path); - region.renderObject = region; if (region == null) throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")"); + region.renderObject = region; let attachment = new RegionAttachment(name); attachment.setRegion(region); attachment.region = region; @@ -51,8 +51,8 @@ module spine { /** @return May be null to not load an attachment. */ newMeshAttachment (skin: Skin, name: string, path: string) : MeshAttachment { let region = this.atlas.findRegion(path); - region.renderObject = region; if (region == null) throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")"); + region.renderObject = region; let attachment = new MeshAttachment(name); attachment.region = region; return attachment;