Commits

Anonymous committed eb88b8a

BasicFieldSet: replace an assertion with an exception

  • Participants
  • Parent commits ec6e52d

Comments (0)

Files changed (1)

File hachoir-core/hachoir_core/field/basic_field_set.py

 
         # Sanity checks (post-conditions)
         assert self.endian in (BIG_ENDIAN, LITTLE_ENDIAN)
-        assert (self._size is None) or (0 < self._size)
+        if (self._size is not None) and (self._size <= 0):
+            raise ParserError("Invalid parser '%s' size: %s" % (self.path, self._size))
 
     def createFields(self):
         raise NotImplementedError()