running scripts in background mode would crash in some cases. (tested all scripts, none segfault now)

This commit is contained in:
2008-09-14 05:10:45 +00:00
parent 0f1a1a159f
commit 1a917f50a6
4 changed files with 134 additions and 14 deletions

View File

@@ -263,9 +263,12 @@ PyObject *LibBlockSeq_getActive(BPy_LibBlockSeq *self)
}
break;
case ID_TXT: {
SpaceText *st= curarea->spacedata.first;
SpaceText *st = NULL;
if (st->spacetype!=SPACE_TEXT || st->text==NULL) {
if (curarea)
st = curarea->spacedata.first;
if (st==NULL || st->spacetype!=SPACE_TEXT || st->text==NULL) {
Py_RETURN_NONE;
} else {
return Text_CreatePyObject( st->text );
@@ -330,7 +333,14 @@ static int LibBlockSeq_setActive(BPy_LibBlockSeq *self, PyObject *value)
return EXPP_ReturnIntError(PyExc_TypeError,
"Must be a text" );
} else {
SpaceText *st= curarea->spacedata.first;
SpaceText *st= NULL;
if (curarea==NULL) {
return 0;
} else {
st= curarea->spacedata.first;
}
Text *data = ((BPy_Text *)value)->text;
if( !data )