mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Check if region is null before property assignment.
This commit is contained in:
parent
67e5f31356
commit
05bf924897
@ -40,8 +40,8 @@ module spine {
|
|||||||
/** @return May be null to not load an attachment. */
|
/** @return May be null to not load an attachment. */
|
||||||
newRegionAttachment (skin: Skin, name: string, path: string): RegionAttachment {
|
newRegionAttachment (skin: Skin, name: string, path: string): RegionAttachment {
|
||||||
let region = this.atlas.findRegion(path);
|
let region = this.atlas.findRegion(path);
|
||||||
region.renderObject = region;
|
|
||||||
if (region == null) throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
if (region == null) throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
||||||
|
region.renderObject = region;
|
||||||
let attachment = new RegionAttachment(name);
|
let attachment = new RegionAttachment(name);
|
||||||
attachment.setRegion(region);
|
attachment.setRegion(region);
|
||||||
attachment.region = region;
|
attachment.region = region;
|
||||||
@ -51,8 +51,8 @@ module spine {
|
|||||||
/** @return May be null to not load an attachment. */
|
/** @return May be null to not load an attachment. */
|
||||||
newMeshAttachment (skin: Skin, name: string, path: string) : MeshAttachment {
|
newMeshAttachment (skin: Skin, name: string, path: string) : MeshAttachment {
|
||||||
let region = this.atlas.findRegion(path);
|
let region = this.atlas.findRegion(path);
|
||||||
region.renderObject = region;
|
|
||||||
if (region == null) throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
if (region == null) throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
||||||
|
region.renderObject = region;
|
||||||
let attachment = new MeshAttachment(name);
|
let attachment = new MeshAttachment(name);
|
||||||
attachment.region = region;
|
attachment.region = region;
|
||||||
return attachment;
|
return attachment;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user