Skip to content

add error log#19147

Open
driftboat wants to merge 2 commits intococos:v3.8.8from
driftboat:v3.8.8
Open

add error log#19147
driftboat wants to merge 2 commits intococos:v3.8.8from
driftboat:v3.8.8

Conversation

@driftboat
Copy link

@driftboat driftboat commented Mar 3, 2026

Re: #

Changelog

  • Reference: Spine4.2, Spine 3.8 – Return immediately if the default skin fails to load, to prevent subsequent reading from causing a Memory access out of bounds error

Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

Greptile Summary

This PR improves error handling in Spine 3.8's SkeletonBinary by adding two related safety checks: (1) calling setError() when newRegionAttachment returns NULL in readAttachment (line 520), and (2) adding an early-return guard after the default skin is read (lines 283–287) so that a failed region attachment causes readSkeletonData to cleanly release resources and return NULL instead of silently continuing with a broken skeleton.

The setError call follows the existing pattern already applied to MeshAttachment failure (line 556), ensuring callers can retrieve meaningful error information via getError(). The early-return guard is correctly positioned between default-skin and non-default-skin reading, preventing continued binary parsing after a fatal attachment-load failure.

The only remaining issue is mixed indentation in the new guard block (lines 283–287): the body uses hard tabs while the rest of the file uses spaces, causing visual misalignment.

Confidence Score: 4/5

  • Safe to merge after fixing the indentation issue in the new guard block.
  • The behavioral changes are correct and well-placed—adding error handling for failed region attachment reads and preventing continued parsing after a fatal load failure. Both patterns match existing code in the file. The score is 4/5 rather than 5 solely due to the mixed indentation (tabs vs. spaces) in lines 283–287, which should be corrected to match the file's space-based style before merging.
  • Fix indentation in native/cocos/editor-support/spine/3.8/spine/SkeletonBinary.cpp (lines 283–287) to use spaces instead of tabs.

Last reviewed commit: 8c71e73

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

…ls to load, to prevent subsequent reading from causing a Memory access out of bounds error.
Comment on lines +283 to +287
if (!this->getError().isEmpty()) {
delete input;
delete skeletonData;
return NULL;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed indentation (tabs vs. spaces)

The inner lines of this new block use hard tabs (\t) for indentation, while the rest of the file uses spaces. This is inconsistent with the surrounding code pattern (e.g., lines 278–281, 294–298) and will appear misaligned in editors configured for space-based indentation.

Suggested change
if (!this->getError().isEmpty()) {
delete input;
delete skeletonData;
return NULL;
}
if (!getError().isEmpty()) {
delete input;
delete skeletonData;
return NULL;
}

Note: The suggestion also removes the unnecessary this-> qualifier on getError(), which aligns with the simpler style in similar code elsewhere in the function.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant