diff --git a/tools/insertkeys.py b/tools/insertkeys.py
index e0eee8d72d99d9e02ddb897554e270b23c058262..7237d6f9ec610859cd348b5ddd9cd24cb77f5f3d 100755
--- a/tools/insertkeys.py
+++ b/tools/insertkeys.py
@@ -79,7 +79,8 @@ class GenerateKeys(object):
# If we haven't started the certificate, then we should not encounter any data
elif not inCert:
- sys.exit("Detected erroneous line \""+ line + "\" on " + str(lineNo)
+ if line is not "":
+ sys.exit("Detected erroneous line \""+ line + "\" on " + str(lineNo)
+ " in pem file: " + path)
# else we have started the certicate and need to append the data