Browse Source

Merge branch 'master' of https://github.com/blackberry/GamePlay

seanpaultaylor 12 years ago
parent
commit
fc7f2de3a2
2 changed files with 11 additions and 11 deletions
  1. 9 11
      gameplay/src/Form.cpp
  2. 2 0
      gameplay/src/Form.h

+ 9 - 11
gameplay/src/Form.cpp

@@ -55,20 +55,18 @@ Form* Form::create(const char* url)
 
     // Load Form from .form file.
     Properties* properties = Properties::create(url);
-    Properties* formProperties = NULL;
-    if (properties)
-    {
-        // Check if the Properties is valid and has a valid namespace.
-        formProperties = (strlen(properties->getNamespace()) > 0) ? properties : properties->getNextNamespace();
-        if (!formProperties || !(strcmpnocase(formProperties->getNamespace(), "form") == 0))
-        {
-            GP_WARN("Invalid properties file for form: %s", url);
-            SAFE_DELETE(properties);
-        }
-    }
     if (!properties)
     {
         GP_WARN("Failed to load properties file for Form.");
+        return NULL;
+    }
+    // Check if the Properties is valid and has a valid namespace.
+    Properties* formProperties = (strlen(properties->getNamespace()) > 0) ? properties : properties->getNextNamespace();
+    if (!formProperties || !(strcmpnocase(formProperties->getNamespace(), "form") == 0))
+    {
+        GP_WARN("Invalid properties file for form: %s", url);
+        SAFE_DELETE(properties);
+        return NULL;
     }
 
     // Load the form's theme style.

+ 2 - 0
gameplay/src/Form.h

@@ -37,6 +37,8 @@ public:
      * Creates a form from a .form properties file.
      * 
      * @param url The URL pointing to the Properties object defining the form. 
+     * 
+     * @return The new form or NULL if there was an error.
      * @script{create}
      */
     static Form* create(const char* url);