handle NULL pointer case.

This commit is contained in:
Vítor Santos Costa 2010-06-14 09:27:48 +01:00
parent e6371c2e0b
commit de336d7ffe

View File

@ -365,12 +365,20 @@ Yap_thread_self(void)
CELL CELL
Yap_thread_create_engine(thread_attr *ops) Yap_thread_create_engine(thread_attr *ops)
{ {
thread_attr opsv;
Term t = TermNil; Term t = TermNil;
int new_id = allocate_new_tid(); int new_id = allocate_new_tid();
if (new_id == -1) { if (new_id == -1) {
/* YAP ERROR */ /* YAP ERROR */
return FALSE; return FALSE;
} }
if (ops == NULL) {
ops = &opsv;
ops->tsize = DefHeapSpace;
ops->ssize = DefStackSpace;
ops->sysize = 0;
ops->egoal = t;
}
if (!init_thread_engine(new_id, ops->ssize, ops->tsize, ops->sysize, &t, &t, &(ops->egoal))) if (!init_thread_engine(new_id, ops->ssize, ops->tsize, ops->sysize, &t, &t, &(ops->egoal)))
return FALSE; return FALSE;
FOREIGN_ThreadHandle(new_id).id = new_id; FOREIGN_ThreadHandle(new_id).id = new_id;