FLEXTool / FLEXTool/FLEX

Crash when opening Realm DB table on debug

Open
#621 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Objective-C
Stars
14.6k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

### Environment
- Platform+version: **iOS 15.5**
- FLEX version: **7.4.0**

### Bug Report

Opening a Realm database on a debug build causes a crash due to an `NSParameterAssert` failure in `FLEXTableContentViewController` seen [here](https://github.com/FLEXTool/FLEX/blob/fb2a33876e33a605f59290c135f2017d7ce73199/Classes/GlobalStateExplorers/DatabaseBrowser/FLEXTableContentViewController.m#L59) and copied below.

```objc
- (instancetype)initWithColumns:(NSArray *)columnNames
rows:(NSArray *> *)rowData
rowIDs:(nullable NSArray *)rowIDs
tableName:(nullable NSString *)tableName
database:(nullable id)databaseManager {
// Must supply all optional parameters as one, or none
BOOL all = rowIDs && tableName && databaseManager;
BOOL none = !rowIDs && !tableName && !databaseManager;
NSParameterAssert(all || none);

//....
}
```

When opening up a SQLLite database table, the `databaseManager` points to null (and so do `rowIDs` and `tableName`) and the `none` condition is satisfied. However when trying to open a Realm database table, the `databaseManager` object pointer is not null and the assert fails. When I remove that assert, the code works as expected and I can view a Realm database.

I've tried to triage this issue myself to provide more a detailed report, but I'm getting some really unexpected behavior with the debugger.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.