Fix array index out of bounds exception

We should be verified string length when the phosphor-webui calls the
getFirmwares function to handle the property value of ExtenVersion.
because it is risky to get the first address of array when that is empty

Tested: Built phosphor-webui and get a effective array of titlePart via
console from WEBUI.

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ife08d208eb7fbeb71284ae0700fb5d871343a298
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js
index 46d7d4b..5a28294 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -1095,12 +1095,15 @@
                             break;
                           }
                         }
-                        var titlePart = parts.splice(0, numberIndex);
-                        titlePart = titlePart.join('');
-                        titlePart = titlePart[0].toUpperCase() +
-                            titlePart.substr(1, titlePart.length);
-                        var versionPart = parts.join('-');
-                        versions.push({title: titlePart, version: versionPart});
+                        if (numberIndex > 0) {
+                          var titlePart = parts.splice(0, numberIndex);
+                          titlePart = titlePart.join('');
+                          titlePart = titlePart[0].toUpperCase() +
+                              titlePart.substr(1, titlePart.length);
+                          var versionPart = parts.join('-');
+                          versions.push(
+                              {title: titlePart, version: versionPart});
+                        }
                       });
 
                       return versions;