Protect against source_filename being None when analyzing constants
authorColin Walters <walters@verbum.org>
Mon, 17 Aug 2009 03:21:20 +0000 (23:21 -0400)
committerColin Walters <walters@verbum.org>
Mon, 17 Aug 2009 03:22:35 +0000 (23:22 -0400)
It's allowed for source_filename to be None if we can't match it
up with a file, so just skip the constant in that case.

giscanner/transformer.py

index cc9e0b5..10d88df 100644 (file)
@@ -501,7 +501,7 @@ class Transformer(object):
     def _create_const(self, symbol):
         # Don't create constants for non-public things
         # http://bugzilla.gnome.org/show_bug.cgi?id=572790
-        if not symbol.source_filename.endswith('.h'):
+        if symbol.source_filename is None or not symbol.source_filename.endswith('.h'):
             return None
         name = self.remove_prefix(symbol.ident)
         if symbol.const_string is not None: