0

Check PyImport_ImportModule return result

This commit is contained in:
Xon
2011-03-25 21:34:06 +08:00
parent 172198558a
commit 1d5b338d56
2 changed files with 8 additions and 0 deletions

View File

@@ -34,6 +34,12 @@ int init_chunk_render(void) {
textures = PyImport_ImportModule("textures");
chunk_mod = PyImport_ImportModule("chunk");
/* ensure none of these pointers are NULL */
if ((!textures) || (!chunk_mod)) {
fprintf(stderr, "\ninit_chunk_render failed\n");
return 1;
}
blockmap = PyObject_GetAttrString(textures, "blockmap");
special_blocks = PyObject_GetAttrString(textures, "special_blocks");
specialblockmap = PyObject_GetAttrString(textures, "specialblockmap");