From dad79082f59c6dcf8e372390410c48c91cb808fa Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 29 2015 07:28:03 +0000 Subject: Ensure there is something in the variable before splitting it --- diff --git a/pagure/ui/repo.py b/pagure/ui/repo.py index 6bf7e15..397908f 100644 --- a/pagure/ui/repo.py +++ b/pagure/ui/repo.py @@ -445,7 +445,7 @@ def view_raw_file(repo, identifier, filename=None, username=None): diff = commit.tree.diff_to_tree(swap=True) data = diff.patch - if not mimetype and data[:2] == '#!': + if not mimetype and data and data[:2] == '#!': mimetype = 'text/plain' if not mimetype: