File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -381,10 +381,12 @@ - (NSString*)getFormatString:(NSString*)format {
381381 NSString *defaultFormat = settingValueType == SettingValueTypeNumber ? @" %.2f " : @" %i " ;
382382
383383 // Identify fmt-like format string
384- if (format.length && [format rangeOfString: @" {" ].location != NSNotFound && [format rangeOfString: @" }" ].location != NSNotFound ) {
384+ NSInteger openBraceLoc = [format rangeOfString: @" {" ].location ;
385+ NSInteger closeBraceLoc = [format rangeOfString: @" }" options: NSBackwardsSearch].location ;
386+ if (format.length && openBraceLoc != NSNotFound && closeBraceLoc != NSNotFound && openBraceLoc < closeBraceLoc) {
385387 // Gather range for unit which is added after last "}"
386388 NSRange range;
387- range.location = [format rangeOfString: @" } " options: NSBackwardsSearch]. location + 1 ;
389+ range.location = closeBraceLoc + 1 ;
388390 range.length = format.length - range.location ;
389391
390392 // Extract unit and make percent character is formatted correctly
You can’t perform that action at this time.
0 commit comments