ctx_data_pointer_verify is a verified NULL value if C is NULL.

prevents ctx_data_main and ctx_data_scene from crashing on NULL context
This commit is contained in:
Martin Poirier 2010-01-27 20:12:54 +00:00
parent 74b2d3681e
commit 1809e04cb4

@ -486,7 +486,12 @@ static int ctx_data_pointer_verify(const bContext *C, const char *member, void *
{
bContextDataResult result;
if(ctx_data_get((bContext*)C, member, &result)==1) {
/* if context is NULL, pointer must be NULL too and that is a valid return */
if (C == NULL) {
*pointer= NULL;
return 1;
}
else if(ctx_data_get((bContext*)C, member, &result)==1) {
*pointer= result.ptr.data;
return 1;
}