diff --git a/native/cocos/editor-support/spine-wasm/spine-wasm.cpp b/native/cocos/editor-support/spine-wasm/spine-wasm.cpp index 1d8d0183046..18024fa31e2 100644 --- a/native/cocos/editor-support/spine-wasm/spine-wasm.cpp +++ b/native/cocos/editor-support/spine-wasm/spine-wasm.cpp @@ -43,14 +43,16 @@ namespace { auto* regionAttachment = static_cast(attachment); attachmentVertices = static_cast(regionAttachment->getRendererObject()); } - auto& textureName = attachmentVertices->_textureId; - if (textureMap.containsKey(textureName)) { - attachmentVertices->_textureId = textureMap[textureName]; - } else { - spine::String logInfo(attachment->getName()); - logInfo.append(" attachment's texture doesn`t exist "); - logInfo.append(textureName); - logToConsole(logInfo.buffer()); + if (attachmentVertices) { + auto& textureName = attachmentVertices->_textureId; + if (textureMap.containsKey(textureName)) { + attachmentVertices->_textureId = textureMap[textureName]; + } else { + spine::String logInfo(attachment->getName()); + logInfo.append(" attachment's texture doesn`t exist "); + logInfo.append(textureName); + logToConsole(logInfo.buffer()); + } } } }