diff --git a/bindings/py3devil1tex.py b/bindings/py3devil1tex.py index 32aeb7f..6300ed1 100644 --- a/bindings/py3devil1tex.py +++ b/bindings/py3devil1tex.py @@ -82,7 +82,8 @@ del libc class pyTexturePack: def __init__(self, filedata): self.cstruct = ctypes.pointer(TexturePack()) - devil1tex.getheader(ctypes.byref(self.cstruct), filedata) + if not devil1tex.getheader(ctypes.byref(self.cstruct), filedata): + raise RuntimeError("failed to get texture pack header") return def show(self): @@ -99,7 +100,12 @@ class pyTextureBatchDescriptor: self.cstruct = ctypes.pointer(TextureBatchDescriptor()) ptrofptr = ctypes.byref(self.cstruct) if filedata: - devil1tex.getbatchdesc(ptrofptr, i, filedata, len(filedata)) + if not devil1tex.getbatchdesc( + ptrofptr, + i, + filedata, + len(filedata)): + raise RuntimeError("failed to get texturebatchdescriptor #" + str(i)) return def show(self): @@ -128,7 +134,12 @@ class pyTextureBatch: self.cstruct.batch = ctypes.cast( ctypes.create_string_buffer(memsize), ctypes.POINTER(Texture)) - devil1tex.gettextures(self.cstruct.batch, i, filedata, len(filedata)) + if not devil1tex.gettextures( + self.cstruct.batch, + i, + filedata, + len(filedata)): + raise RuntimeError("failed to get textures of batch #" + str(i)) return def gettextures(self):