Trap null pointer missing gas components.

git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/trunk@10317 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2015-09-29 19:33:39 +00:00
parent 64703778f0
commit 3f332d180b

View File

@ -981,8 +981,11 @@ tidy_gas_phase(void)
struct phase *phase_ptr = phase_bsearch(gas_phase_ptr->Get_gas_comps()[j_PR].Get_phase_name().c_str(), &k, FALSE);
if (gc[j_PR].Get_p_read() == 0)
continue;
phase_ptr->moles_x = gc[j_PR].Get_p_read() / P;
phase_ptrs.push_back(phase_ptr);
if (phase_ptr)
{
phase_ptr->moles_x = gc[j_PR].Get_p_read() / P;
phase_ptrs.push_back(phase_ptr);
}
}
V_m = calc_PR(phase_ptrs, P, gas_phase_ptr->Get_temperature(), 0);
gas_phase_ptr->Set_v_m(V_m);
@ -999,9 +1002,11 @@ tidy_gas_phase(void)
gc[j_PR].Set_moles(0.0);
} else
{
gc[j_PR].Set_moles(phase_ptr->moles_x *
gas_phase_ptr->Get_volume() / V_m);
gas_phase_ptr->Set_total_moles(gas_phase_ptr->Get_total_moles() + gc[j_PR].Get_moles());
if (phase_ptr)
{
gc[j_PR].Set_moles(phase_ptr->moles_x * gas_phase_ptr->Get_volume() / V_m);
gas_phase_ptr->Set_total_moles(gas_phase_ptr->Get_total_moles() + gc[j_PR].Get_moles());
}
}
}
}