com/containers; dataTypes: Null checks
authorJerome St-Louis <jerome@ecere.com>
Tue, 17 Nov 2015 05:04:23 +0000 (00:04 -0500)
committerJerome St-Louis <jerome@ecere.com>
Wed, 9 Dec 2015 18:04:40 +0000 (13:04 -0500)
- Support for returning non-capitalized enum strings if OnGetString()'s tempString parameter is null

ecere/src/com/containers/Container.ec
ecere/src/com/containers/Map.ec
ecere/src/com/dataTypes.ec

index 532758d..d357a5f 100644 (file)
@@ -102,7 +102,7 @@ public class Container<class T, class I = int, class D = T>
 {
 public:
    class_fixed
-   public property Container<T> copySrc { set { Copy(value); } }
+   public property Container<T> copySrc { set { if(value) Copy(value); } }
    property Iterator<T> firstIterator { get { value = { (Container<T>)this, pointer = GetFirst() }; } }
    property Iterator<T> lastIterator  { get { value = { (Container<T>)this, pointer = GetLast() }; } }
 
index 4d5d19e..2c21008 100644 (file)
@@ -237,7 +237,7 @@ public class Map<class MT, class V> : CustomAVLTree<MapNode<MT, V>, I = MT, D =
       {
          IteratorPointer i;
          RemoveAll();
-         if(eClass_IsDerived(value._class, class(Map)))
+         if(value && eClass_IsDerived(value._class, class(Map)))
          {
             for(i = value.GetFirst(); i; i = value.GetNext(i))
             {
index 644c40f..0e2ebb3 100644 (file)
@@ -222,11 +222,15 @@ public:
    }
    if(item)
    {
-      strcpy(tempString, item.name);
-      if(!needClass || !*needClass)
-         tempString[0] = (char)toupper(tempString[0]);
-      return tempString;
-      //return item.name;
+      if(tempString)
+      {
+         strcpy(tempString, item.name);
+         if(!needClass || !*needClass)
+            tempString[0] = (char)toupper(tempString[0]);
+         return tempString;
+      }
+      else
+         return item.name;
    }
    else
       return null;