Skip to content

Commit

Permalink
F53OSCMessage: fix argumentsWithString: which expects non-nil retur…
Browse files Browse the repository at this point in the history
…n values
  • Loading branch information
balord committed Aug 2, 2022
1 parent 2098128 commit 121c1a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/F53OSC/F53OSCMessage.m
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ + (nullable F53OSCMessage *) messageWithString:(NSString *)qscString
// The remaining " characters signify quoted string arguments; they should be paired up.
NSArray<NSString *> *splitOnQuotes = [workingArguments componentsSeparatedByString:@"\""];
if ( [splitOnQuotes count] % 2 != 1 )
return nil; // not matching quotes
return @[]; // not matching quotes

NSString *QUOTED_STRING_TOKEN = @""; // not trying to be perfect here; we just use an unlikely character
NSMutableArray<NSString *> *quotedStrings = [NSMutableArray array];
Expand Down Expand Up @@ -231,7 +231,7 @@ + (nullable F53OSCMessage *) messageWithString:(NSString *)qscString
// If `arg` has any additional characters either before or after QUOTED_STRING_TOKEN, parsing fails.
// i.e. if `workingArguments` has quoted strings that are not properly separated by spaces.
if ( [arg isEqual:QUOTED_STRING_TOKEN] == NO )
return nil;
return @[];

NSString *quotedString = [quotedStrings objectAtIndex:quotedStringIndex];
NSString *detokenized = [quotedString detokenizedUnescapedString];
Expand Down

0 comments on commit 121c1a2

Please sign in to comment.