fix(ios): guard against nil iconImage in marker setImage callback#184
fix(ios): guard against nil iconImage in marker setImage callback#184mym0404 merged 2 commits intomym0404:mainfrom
Conversation
NMFMarker crashes with SIGABRT when iconImage is set to nil. This happens when getImage callback returns nil (e.g. image load failure). Add nil check before setting iconImage to prevent crash. Fixes mym0404#183
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c606352e1e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (image) { | ||
| self.inner.alpha = 1; | ||
| self.inner.iconImage = image; |
There was a problem hiding this comment.
Restore marker alpha when callback image is nil
setImage hides the marker with _inner.alpha = 0 before requesting the image, but this change now restores alpha only inside if (image). Because nmap::getImage can legally call back with nil (e.g., unsupported symbol or failed image resolution), the marker remains permanently transparent after the callback, so users see missing markers instead of a fallback/default icon. Keep alpha restoration outside the nil guard (and optionally preserve/set a fallback icon) to avoid this regression.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
To use Codex here, create an environment for this repo.
|
@codex accept above suggestion/ |
|
Codex couldn't complete this request. Try again later. |
… markers Move `self.inner.alpha = 1` outside the `if (image)` block so that markers always become visible again after the getImage callback, even when the image is nil. Previously, a nil callback left the marker permanently transparent (alpha = 0) since alpha restoration was only inside the nil guard. Addresses review feedback from @chatgpt-codex-connector. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@spencer0124 Thank you for your edit. I'll merge this PR soon. |
Summary
NMFMarker.iconImagein thegetImagecallback to prevent crash when image is nilProblem
NMFMarkercrashes withSIGABRTwheniconImageis set tonil. This occurs whennmap::getImagereturnsnilvia callback (e.g., image load failure, unsupported symbol name).Crash stack:
Root Cause
ImageUtil.h'sgetImagecan callcallback(nil)in two places (line 80, line 112), butRNCNaverMapMarker.mm:103setsself.inner.iconImage = imagewithout nil check.Fix
One-line nil guard before setting iconImage.
Fixes #183
🤖 Generated with Claude Code