Skip to content

Commit

Permalink
fix another crash with invalid SOAP (soap was detached before SOAP up…
Browse files Browse the repository at this point in the history
…date function ran)
  • Loading branch information
jacob1 committed Nov 22, 2015
1 parent 7a78b91 commit 5be9773
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/simulation/elements/SOAP.cpp
Expand Up @@ -50,13 +50,13 @@ Element_SOAP::Element_SOAP()
//#TPT-Directive ElementHeader Element_SOAP static void detach(Simulation * sim, int i)
void Element_SOAP::detach(Simulation * sim, int i)
{
if ((sim->parts[i].ctype&2) == 2 && sim->parts[sim->parts[i].tmp].type == PT_SOAP)
if ((sim->parts[i].ctype&2) == 2 && sim->parts[i].tmp >= 0 && sim->parts[i].tmp < NPART && sim->parts[sim->parts[i].tmp].type == PT_SOAP)
{
if ((sim->parts[sim->parts[i].tmp].ctype&4) == 4)
sim->parts[sim->parts[i].tmp].ctype ^= 4;
}

if ((sim->parts[i].ctype&4) == 4 && sim->parts[sim->parts[i].tmp2].type == PT_SOAP)
if ((sim->parts[i].ctype&4) == 4 && sim->parts[i].tmp2 >= 0 && sim->parts[i].tmp2 < NPART && sim->parts[sim->parts[i].tmp2].type == PT_SOAP)
{
if ((sim->parts[sim->parts[i].tmp2].ctype&2) == 2)
sim->parts[sim->parts[i].tmp2].ctype ^= 2;
Expand Down

0 comments on commit 5be9773

Please sign in to comment.