Rearranged package.name check to avoid crash

Buildozer would previously crash if a package name was '', as it checked
for zero length *and* tried to check if the first character was a
number.
This commit is contained in:
Alexander Taylor 2013-11-24 17:47:15 +00:00
parent feff9c2b23
commit 2800d516da

View file

@ -300,13 +300,13 @@ class Buildozer(object):
adderror = errors.append
if not get('app', 'title', ''):
adderror('[app] "title" is missing')
if not get('app', 'package.name', ''):
adderror('[app] "package.name" is missing')
if not get('app', 'source.dir', ''):
adderror('[app] "source.dir" is missing')
package_name = get('app', 'package.name', '')
if package_name[0] in map(str, range(10)):
if not package_name:
adderror('[app] "package.name" is missing')
elif package_name[0] in map(str, range(10)):
adderror('[app] "package.name" may not start with a number.')
version = get('app', 'version', '')