JohnSundell / JohnSundell/JSAutoEncodedObject
Decoding Error getting Class Name
- Dominant language
- Objective-C
- Stars
- 3
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
Was having issues trying to restore a dictionary representation.
Erroring because the length of the range was out of range.
`NSString *typeClassName = [typeAttribute substringWithRange:NSMakeRange(3, [typeAttribute length] - 4)];`
After debugging a bit...
```
if (![typeAttribute hasPrefix:@"T@"]) {
return originalValue;
}
```
Passes but the typeAttibute full string was "T@"
checking further this was on a property of "id" type.
I added a check
` BOOL lengthOK = ([typeAttribute length] > 5);`
and added:
```
if (!lengthOK) {
return originalValue;
}
```
and then things worked fine
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.