Fix pre commit script break

There is no validation handle before checking the page title name
from the router. Which causes the pre-commit script to through error.
This patch set will handle this scenario and fix the break.

Change-Id: I5aed3bfeba643c2eb2b2753bf8f6d984b5100361
Signed-off-by: Kirankumar Ballapalli <kirankumarb@ami.com>
diff --git a/src/components/Global/PageTitle.vue b/src/components/Global/PageTitle.vue
index e195d1a..f5e6df9 100644
--- a/src/components/Global/PageTitle.vue
+++ b/src/components/Global/PageTitle.vue
@@ -21,18 +21,20 @@
     };
   },
   created() {
-    var title = this.$route.name;
-    var i = 1;
-    while (i < this.$route.name.split('-').length) {
-      var index = title.search('-');
-      title = title.replace(
-        '-' + title.charAt(index + 1),
-        title.charAt(index + 1).toUpperCase()
-      );
-      i++;
+    let title = this.$route.name;
+    let i = 1;
+    if (title) {
+      while (i < this.$route.name.split('-').length) {
+        let index = title.search('-');
+        title = title.replace(
+          '-' + title.charAt(index + 1),
+          title.charAt(index + 1).toUpperCase()
+        );
+        i++;
+      }
+      this.title = i18n.t('appPageTitle.' + title);
+      document.title = this.title;
     }
-    this.title = i18n.t('appPageTitle.' + title);
-    document.title = this.title;
   },
 };
 </script>