- Fixed some sanity checks in the computation of the preceding label

sets. This prevents a potential crash.
This commit is contained in:
ccremers 2004-07-05 09:37:31 +00:00
parent a8130f10ee
commit 35c7ff1877

View File

@ -789,16 +789,25 @@ compute_prec_sets (const System sys)
pr = sys->protocols; pr = sys->protocols;
ro = pr->roles; ro = pr->roles;
while (r > 0) while (r > 0 && ro != NULL)
{ {
ro = ro->next; ro = ro->next;
if (ro == NULL) if (ro == NULL)
{ {
pr = pr->next; pr = pr->next;
if (pr != NULL)
{
ro = pr->roles; ro = pr->roles;
} }
else
{
ro = NULL;
}
}
r--; r--;
} }
if (ro != NULL)
{
rd = ro->roledef; rd = ro->roledef;
while (lev > 0 && rd != NULL) while (lev > 0 && rd != NULL)
{ {
@ -807,6 +816,11 @@ compute_prec_sets (const System sys)
} }
return rd; return rd;
} }
else
{
return NULL;
}
}
// Assist: print matrix // Assist: print matrix
void void
@ -904,7 +918,7 @@ compute_prec_sets (const System sys)
Roledef rd1; Roledef rd1;
rd1 = roledef_re(r1,ev1); rd1 = roledef_re(r1,ev1);
if (rd1->type == SEND) if (rd1 != NULL && rd1->type == SEND)
{ {
r2 = 0; r2 = 0;
while (r2 < sys->rolecount) while (r2 < sys->rolecount)
@ -915,7 +929,7 @@ compute_prec_sets (const System sys)
Roledef rd2; Roledef rd2;
rd2 = roledef_re(r2,ev2); rd2 = roledef_re(r2,ev2);
if (rd2->type == READ && isTermEqual(rd1->label, rd2->label)) if (rd2 != NULL && rd2->type == READ && isTermEqual(rd1->label, rd2->label))
{ {
prec[index2(index(r1,ev1),index(r2,ev2))] = 1; prec[index2(index(r1,ev1),index(r2,ev2))] = 1;
} }