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