[Reportbug-commits] [reportbug] 21/27: utils.py: Fix IndexError: list index out of range

Sandro Tosi morph at moszumanska.debian.org
Mon May 29 20:14:06 UTC 2017


This is an automated email from the git hooks/post-receive script.

morph pushed a commit to branch master
in repository reportbug.

commit 37178b7849b7fc3af083c2a01316770f3de2381e
Author: Nis Martensen <nis.martensen at web.de>
Date:   Sat Apr 22 11:43:19 2017 +0200

    utils.py: Fix IndexError: list index out of range
    
    re.findall() called with a regexp containing groups will return a list
    of tuples. In our case: a list containing zero or exactly one tuple.
    
    Since we are storing the result in a list anyway, simply add the two
    lists and do not try to extract an element first. If re.findall()
    returns an empty list, this does nothing and will no longer crash.
---
 reportbug/utils.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/reportbug/utils.py b/reportbug/utils.py
index e6fa716..8139668 100644
--- a/reportbug/utils.py
+++ b/reportbug/utils.py
@@ -383,7 +383,7 @@ def get_package_status(package, avail=False):
                 confmode = False
             else:
                 # re is used to identify also conffiles with spaces in the name
-                conffiles = conffiles + [re.findall(r' (.+) ([0-9a-f]+).*$', line)[0]]
+                conffiles += re.findall(r' (.+) ([0-9a-f]+).*$', line)
 
         if versionre.match(line):
             (crud, pkgversion) = line.split(": ", 1)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reportbug/reportbug.git



More information about the Reportbug-commits mailing list