Check PyImport_ImportModule return result
This commit is contained in:
@@ -32,6 +32,8 @@ import util
|
|||||||
|
|
||||||
logging.basicConfig(level=logging.INFO,format="%(asctime)s [%(levelname)s] %(message)s")
|
logging.basicConfig(level=logging.INFO,format="%(asctime)s [%(levelname)s] %(message)s")
|
||||||
|
|
||||||
|
#import this before to ensure it doesn't have an errors or c_overviewer will eat them
|
||||||
|
import chunk
|
||||||
# make sure the c_overviewer extension is available
|
# make sure the c_overviewer extension is available
|
||||||
try:
|
try:
|
||||||
import c_overviewer
|
import c_overviewer
|
||||||
|
|||||||
@@ -34,6 +34,12 @@ int init_chunk_render(void) {
|
|||||||
textures = PyImport_ImportModule("textures");
|
textures = PyImport_ImportModule("textures");
|
||||||
chunk_mod = PyImport_ImportModule("chunk");
|
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");
|
blockmap = PyObject_GetAttrString(textures, "blockmap");
|
||||||
special_blocks = PyObject_GetAttrString(textures, "special_blocks");
|
special_blocks = PyObject_GetAttrString(textures, "special_blocks");
|
||||||
specialblockmap = PyObject_GetAttrString(textures, "specialblockmap");
|
specialblockmap = PyObject_GetAttrString(textures, "specialblockmap");
|
||||||
|
|||||||
Reference in New Issue
Block a user