When branch is not correctly set, it would throw an exception.

Review URL: http://codereview.chromium.org/2087015

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@47678 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gclient_scm.py b/gclient_scm.py
index 3a0b537..fb2ec28 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -574,6 +574,8 @@
     # Returns name of current branch
     # Returns None if inside a (no branch)
     tokens = self._Run(['branch']).split()
+    if not '*' in tokens:
+      return None
     branch = tokens[tokens.index('*') + 1]
     if branch == '(no':
       return None