Skip to content
Snippets Groups Projects
Commit 6d7f8fe0 authored by cramakri's avatar cramakri
Browse files

MINOR : Handle null values for properties

SVN: 28112
parent 350e432a
No related branches found
No related tags found
No related merge requests found
...@@ -250,7 +250,9 @@ ...@@ -250,7 +250,9 @@
{ {
NSDictionary *properties = [self propertiesAtIndexPath: indexPath]; NSDictionary *properties = [self propertiesAtIndexPath: indexPath];
NSString *label = [properties valueForKey: @"label"]; NSString *label = [properties valueForKey: @"label"];
if ([[NSNull null] isEqual: label]) label = @"";
NSString *value = [properties valueForKey: @"value"]; NSString *value = [properties valueForKey: @"value"];
if ([[NSNull null] isEqual: value]) value = @"";
// Font and size obtained from the storyboard // Font and size obtained from the storyboard
CGFloat labelFontSize = 12.f; CGFloat labelFontSize = 12.f;
...@@ -291,8 +293,14 @@ ...@@ -291,8 +293,14 @@
if (!self.detailItem) return; if (!self.detailItem) return;
NSDictionary *properties; NSDictionary *properties;
properties = [self propertiesAtIndexPath: indexPath]; properties = [self propertiesAtIndexPath: indexPath];
cell.textLabel.text = [properties valueForKey: @"label"];
cell.detailTextLabel.text = [properties valueForKey: @"value"]; NSString *label = [properties valueForKey: @"label"];
if ([[NSNull null] isEqual: label]) label = @"";
NSString *value = [properties valueForKey: @"value"];
if ([[NSNull null] isEqual: value]) value = @"";
cell.textLabel.text = label;
cell.detailTextLabel.text = value;
} }
#pragma mark - Status Updates #pragma mark - Status Updates
...@@ -341,7 +349,7 @@ ...@@ -341,7 +349,7 @@
NSError* errorOrNil = [[note userInfo] valueForKey: NSUnderlyingErrorKey]; NSError* errorOrNil = [[note userInfo] valueForKey: NSUnderlyingErrorKey];
if (errorOrNil) { if (errorOrNil) {
NSString *description = [[errorOrNil userInfo] valueForKey: NSLocalizedDescriptionKey]; NSString *description = [[errorOrNil userInfo] valueForKey: NSLocalizedDescriptionKey];
NSString *statusText = [NSString stringWithFormat: @"Could not drill :%@", description]; NSString *statusText = [NSString stringWithFormat: @"Could not drill: %@", description];
[self setStatusText: statusText]; [self setStatusText: statusText];
} else { } else {
[self clearStatusText]; [self clearStatusText];
...@@ -352,7 +360,7 @@ ...@@ -352,7 +360,7 @@
NSError* errorOrNil = [[note userInfo] valueForKey: NSUnderlyingErrorKey]; NSError* errorOrNil = [[note userInfo] valueForKey: NSUnderlyingErrorKey];
if (errorOrNil) { if (errorOrNil) {
NSString *description = [[errorOrNil userInfo] valueForKey: NSLocalizedDescriptionKey]; NSString *description = [[errorOrNil userInfo] valueForKey: NSLocalizedDescriptionKey];
NSString *statusText = [NSString stringWithFormat: @"Could not retrieve details :%@", description]; NSString *statusText = [NSString stringWithFormat: @"Could not retrieve details: %@", description];
[self setStatusText: statusText]; [self setStatusText: statusText];
} else { } else {
[self clearStatusText]; [self clearStatusText];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment