Skip to content

Commit

Permalink
Fix crash while texture load failed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Geequlim committed Aug 3, 2017
1 parent 3c99bde commit fafc2db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions register_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ void _spAtlasPage_createTexture(spAtlasPage* self, const char* path) {

void _spAtlasPage_disposeTexture(spAtlasPage* self) {

TextureRef *ref = static_cast<TextureRef *>(self->rendererObject);
memdelete(ref);
if(TextureRef *ref = static_cast<TextureRef *>(self->rendererObject))
memdelete(ref);
}


Expand Down
14 changes: 6 additions & 8 deletions spine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,16 @@ void Spine::_spine_dispose() {

static Ref<Texture> spine_get_texture(spRegionAttachment* attachment) {

Ref<Texture> *ref = static_cast<Ref<Texture> *>(
((spAtlasRegion*)attachment->rendererObject)->page->rendererObject
);
return *ref;
if(Ref<Texture> *ref = static_cast<Ref<Texture> *>(((spAtlasRegion*)attachment->rendererObject)->page->rendererObject))
return *ref;
return NULL;
}

static Ref<Texture> spine_get_texture(spMeshAttachment* attachment) {

Ref<Texture> *ref = static_cast<Ref<Texture> *>(
((spAtlasRegion*)attachment->rendererObject)->page->rendererObject
);
return *ref;
if(Ref<Texture> *ref = static_cast<Ref<Texture> *>(((spAtlasRegion*)attachment->rendererObject)->page->rendererObject))
return *ref;
return NULL;
}

void Spine::_on_fx_draw() {
Expand Down

0 comments on commit fafc2db

Please sign in to comment.