From 7a60bb98774ed433b952048a48857c9c60e08342 Mon Sep 17 00:00:00 2001 From: David L Parkhurst Date: Tue, 11 Mar 2008 22:04:33 +0000 Subject: [PATCH] Write around assert. git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@2746 1feff8c3-07ed-0310-ac33-dd36852eb9cd --- Surface.cxx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Surface.cxx b/Surface.cxx index 81c6565d..ab3bf3d9 100644 --- a/Surface.cxx +++ b/Surface.cxx @@ -170,16 +170,19 @@ struct surface *cxxSurface::cxxSurface2surface() surface_ptr->count_charge = 0; } // Need to fill in charge (number) in comps list - int i,j; - for (i = 0; i < surface_ptr->count_comps; i++) { - char *charge_name = cxxSurfaceComp::get_charge_name(surface_ptr->comps[i].formula); - for (j = 0; j < surface_ptr->count_charge; j++) { - if (charge_name == surface_ptr->charge[j].name) { - surface_ptr->comps[i].charge = j; - break; + if (surface_ptr->type != NO_EDL) + { + int i,j; + for (i = 0; i < surface_ptr->count_comps; i++) { + char *charge_name = cxxSurfaceComp::get_charge_name(surface_ptr->comps[i].formula); + for (j = 0; j < surface_ptr->count_charge; j++) { + if (charge_name == surface_ptr->charge[j].name) { + surface_ptr->comps[i].charge = j; + break; + } } + assert(j < surface_ptr->count_charge); } - assert(j < surface_ptr->count_charge); } return(surface_ptr);