From c24c720b6135a8f7975bf9af265124eee2d464cb Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 2 Jul 2009 16:12:57 -0700 Subject: Fix error parsing a non-existant configuration file If a file (e.g. ~/.gitconfig) does not exist, we get None here rather than a string. NoneType lacks rstrip() so we cannot strip it. Signed-off-by: Shawn O. Pearce --- git_config.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'git_config.py') diff --git a/git_config.py b/git_config.py index e658b059..e1e20463 100644 --- a/git_config.py +++ b/git_config.py @@ -265,9 +265,11 @@ class GitConfig(object): This internal method populates the GitConfig cache. """ - d = self._do('--null', '--list').rstrip('\0') c = {} - for line in d.split('\0'): + d = self._do('--null', '--list') + if d is None: + return c + for line in d.rstrip('\0').split('\0'): if '\n' in line: key, val = line.split('\n', 1) else: -- cgit v1.2.3-54-g00ecf