Skip to content

Commit

Permalink
Added ability to display decoded binary data when it is not a valid N…
Browse files Browse the repository at this point in the history
…SString

Signed-off-by: Dave Poirier <[email protected]>
  • Loading branch information
Dave Poirier committed Jun 2, 2014
1 parent 9eeb9a2 commit 546fb6c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Base64/MF_AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,14 @@ -(void)decode:(id)sender
NSString *encoded = [_textField stringValue];
NSData *data = [NSData dataWithBase64String:encoded];
NSString *raw = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
[_textField setStringValue:raw];
if( raw )
{
[_textField setStringValue:raw];
}
else
{
[_textField setStringValue:[NSString stringWithFormat:@"WARNING: data could not be converted to a NSString, dumping decoded binary data: %@", data]];
}
}

@end

0 comments on commit 546fb6c

Please sign in to comment.