added checks for allocator callback being null

develop
doomchild 2011-03-03 14:17:09 -06:00
parent 4cf037d5d3
commit 2c9016d2f2
1 changed files with 18 additions and 0 deletions

@ -233,6 +233,9 @@ t_matgloss* Materials_getInorganic(DFHackObject* mat)
if(materials->inorganic.size() > 0)
{
t_matgloss* buf = NULL;
if(alloc_matgloss_buffer_callback == NULL)
return NULL;
((*alloc_matgloss_buffer_callback)(buf, materials->inorganic.size()));
@ -258,6 +261,9 @@ t_matgloss* Materials_getOrganic(DFHackObject* mat)
{
t_matgloss* buf = NULL;
if(alloc_matgloss_buffer_callback == NULL)
return NULL;
((*alloc_matgloss_buffer_callback)(buf, materials->organic.size()));
if(buf != NULL)
@ -282,6 +288,9 @@ t_matgloss* Materials_getTree(DFHackObject* mat)
{
t_matgloss* buf = NULL;
if(alloc_matgloss_buffer_callback == NULL)
return NULL;
((*alloc_matgloss_buffer_callback)(buf, materials->tree.size()));
if(buf != NULL)
@ -306,6 +315,9 @@ t_matgloss* Materials_getPlant(DFHackObject* mat)
{
t_matgloss* buf = NULL;
if(alloc_matgloss_buffer_callback == NULL)
return NULL;
((*alloc_matgloss_buffer_callback)(buf, materials->plant.size()));
if(buf != NULL)
@ -330,6 +342,9 @@ t_matgloss* Materials_getRace(DFHackObject* mat)
{
t_matgloss* buf = NULL;
if(alloc_matgloss_buffer_callback == NULL)
return NULL;
((*alloc_matgloss_buffer_callback)(buf, materials->race.size()));
if(buf != NULL)
@ -356,6 +371,9 @@ c_creaturetype* Materials_getRaceEx(DFHackObject* mat)
{
c_creaturetype* buf = NULL;
if(alloc_creaturetype_buffer_callback == NULL)
return NULL;
((*alloc_creaturetype_buffer_callback)(buf, matSize));
if(buf != NULL)