From 6d7f8fe097c11b4457e1f84ff79916db801802aa Mon Sep 17 00:00:00 2001
From: cramakri <cramakri>
Date: Wed, 16 Jan 2013 06:02:45 +0000
Subject: [PATCH] MINOR : Handle null values for properties

SVN: 28112
---
 .../openBIS/openBIS/CISDOBDetailViewController.m | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/openbis-ipad/openBIS/openBIS/CISDOBDetailViewController.m b/openbis-ipad/openBIS/openBIS/CISDOBDetailViewController.m
index 64c25399913..99f1a65458a 100644
--- a/openbis-ipad/openBIS/openBIS/CISDOBDetailViewController.m
+++ b/openbis-ipad/openBIS/openBIS/CISDOBDetailViewController.m
@@ -250,7 +250,9 @@
 {
     NSDictionary *properties = [self propertiesAtIndexPath: indexPath];
     NSString *label = [properties valueForKey: @"label"];
+    if ([[NSNull null] isEqual: label]) label = @"";
     NSString *value = [properties valueForKey: @"value"];
+    if ([[NSNull null] isEqual: value]) value = @"";
 
     // Font and size obtained from the storyboard
     CGFloat labelFontSize = 12.f;
@@ -291,8 +293,14 @@
     if (!self.detailItem) return;
     NSDictionary *properties;
     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
@@ -341,7 +349,7 @@
         NSError* errorOrNil = [[note userInfo] valueForKey: NSUnderlyingErrorKey];
         if (errorOrNil) {
             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];
         } else {
             [self clearStatusText];
@@ -352,7 +360,7 @@
         NSError* errorOrNil = [[note userInfo] valueForKey: NSUnderlyingErrorKey];
         if (errorOrNil) {
             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];
         } else {
             [self clearStatusText];
-- 
GitLab