diff --git a/src/gitgraph.js b/src/gitgraph.js
index <HASH>..<HASH> 100644
--- a/src/gitgraph.js
+++ b/src/gitgraph.js
@@ -78,7 +78,8 @@
       break;
     default:
       this.orientation = "vertical";
-      this.template.branch.labelRotation =  options.template.branch !== undefined &&
+
+      this.template.branch.labelRotation =  _isDefined(options, 'template.branch.labelRotation') &&
                                             options.template.branch.labelRotation !== null ?
                                             options.template.branch.labelRotation : 0;
       break;
@@ -1557,6 +1558,15 @@
     return (typeof object === "object");
   }
 
+  function _isDefined(obj, key) {
+    return key.split(".").every(function(x) {
+        if(typeof obj != "object" || obj === null || ! x in obj)
+            return false;
+        obj = obj[x];
+        return true;
+    });
+  }
+
   // Expose GitGraph object
   window.GitGraph = GitGraph;
   window.GitGraph.Branch = Branch;
Added utility function to check for undefined values in nested object properties.