maplibre / maplibre/maplibre-react-native
[iOS] SIGABRT in MLRNLogModule when MapLibre network errorLog passes nil message
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 661
- Forks
- 124
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 30
Description
### Describe and reproduce the Bug
On iOS production / TestFlight, the app aborts when MapLibre Native logs a network error. The crash is not the network failure itself — MLRNLogModule builds an NSDictionary literal with a nil value and throws.
this is kind of similar to [#1597](https://github.com/maplibre/maplibre-react-native/issues/1597) and [#1540](https://github.com/maplibre/maplibre-react-native/issues/1540)
Exception
```
EXC_CRASH (SIGABRT)
*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[2]
```
Symbolicated last exception backtrace
```
-[MLRNLogModule logging:didReceiveLogWithLevel:filePath:line:message:] + 144 (MLRNLogModule.mm:36)
-[MLRNLogging sendLogWithLevel:filePath:line:message:] (MLRNLogging.m:61)
__19-[MLRNLogging init]_block_invoke (MLRNLogging.m:23)
-[MLNLoggingConfiguration logCallingFunction:functionLine:messageType:format:]
-[MLNNetworkConfiguration errorLog:]
-[MLNNativeNetworkManager errorLog:]
mbgl::HTTPFileSource::request(...) completion (http_file_source.mm)
CFNetwork / NSURLSession task finish
```
Offending code (`package/ios/modules/logging/MLRNLogModule.mm`, still present on main):
```
- (void)logging:(nonnull id)logging
didReceiveLogWithLevel:(nonnull NSString *)level
filePath:(nonnull NSString *)filePath
line:(NSUInteger)line
message:(nonnull NSString *)message {
[self emitOnLog:@{@"level" : level, @"tag" : filePath, @"message" : message}];
}
```
`objects[2]` is the third value (`message`). Despite `nonnull` annotations, MapLibre’s `MLNLoggingConfiguration` handler can invoke this with a nil `message` (and possibly nil `filePath`) when `errorLog`: runs after a failed HTTP tile/style request.
`MLRNLogging.m` forwards `filePath` / `message` straight through with no nil coalesce.
Suggested fix
```git
[self emitOnLog:@{
@"level" : level ?: @"unknown",
@"tag" : filePath ?: @"",
@"message" : message ?: @""
}];
```
(Alternatively skip emit when `message == nil`, but coalescing keeps JS log listeners usable.)
Observed in the wild
App: production TestFlight build
Package: `@maplibre/maplibre-react-native` v11.3.6
Device: iPhone17,1 / iOS 26.6
Multiple identical crash points clustered after map network activity (~1–2 min after launch)
Related pattern (nil into ObjC collection → abort): #1240 / #1597
Logging-path crash precedent on Android: #1417
I don’t yet have a minimal public repo that forces MapLibre to call `errorLog:` with a nil message; happy to iterate if maintainers know a reliable way to trigger that path. Happy to open a PR with the coalesce above.
### @maplibre/maplibre-react-native Version
11.3.6
### Which platforms does this occur on?
iOS Device
### Which frameworks does this occur on?
Expo
### Which architectures does this occur on?
New Architecture
### Environment
```text
@maplibre/maplibre-react-native: 11.3.6
Expo / React Native (New Architecture)
iOS 26.6 physical device (TestFlight)
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with package/ios/modules/logging/MLRNLogModule.mm:36 and then inspect package/ios/modules/logging/MLRNLogging.m, where filePath and message are forwarded. Trace the logging callback used by MapLibre network errors and verify that nil values cannot abort NSDictionary creation. Done when network-error logging remains usable without an iOS SIGABRT.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, objective-c, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100