mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
Added extra check in IPhreeqc::GetSelectedOutputValue
git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/trunk@8195 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
7eda614aac
commit
fef2ebd9db
54
IPhreeqc.cpp
54
IPhreeqc.cpp
@ -420,6 +420,8 @@ const char* IPhreeqc::GetSelectedOutputStringLine(int n)
|
|||||||
{
|
{
|
||||||
return empty;
|
return empty;
|
||||||
}
|
}
|
||||||
|
// don't need to check CurrentSelectedOutputUserNumber since
|
||||||
|
// GetSelectedOutputStringLineCount will catch
|
||||||
return this->SelectedOutputLinesMap[this->CurrentSelectedOutputUserNumber][n].c_str();
|
return this->SelectedOutputLinesMap[this->CurrentSelectedOutputUserNumber][n].c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,7 +432,7 @@ int IPhreeqc::GetSelectedOutputStringLineCount(void)const
|
|||||||
{
|
{
|
||||||
return (int) (*cit).second.size();
|
return (int) (*cit).second.size();
|
||||||
}
|
}
|
||||||
return (int)0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IPhreeqc::GetSelectedOutputStringOn(void)const
|
bool IPhreeqc::GetSelectedOutputStringOn(void)const
|
||||||
@ -440,6 +442,7 @@ bool IPhreeqc::GetSelectedOutputStringOn(void)const
|
|||||||
|
|
||||||
VRESULT IPhreeqc::GetSelectedOutputValue(int row, int col, VAR* pVAR)
|
VRESULT IPhreeqc::GetSelectedOutputValue(int row, int col, VAR* pVAR)
|
||||||
{
|
{
|
||||||
|
VRESULT v;
|
||||||
this->ErrorReporter->Clear();
|
this->ErrorReporter->Clear();
|
||||||
if (!pVAR)
|
if (!pVAR)
|
||||||
{
|
{
|
||||||
@ -448,26 +451,37 @@ VRESULT IPhreeqc::GetSelectedOutputValue(int row, int col, VAR* pVAR)
|
|||||||
return VR_INVALIDARG;
|
return VR_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
VRESULT v = this->SelectedOutputMap[this->CurrentSelectedOutputUserNumber]->Get(row, col, pVAR);
|
std::map< int, CSelectedOutput* >::const_iterator ci = this->SelectedOutputMap.find(this->CurrentSelectedOutputUserNumber);
|
||||||
switch (v)
|
if (ci != this->SelectedOutputMap.end())
|
||||||
{
|
{
|
||||||
case VR_OK:
|
v = this->SelectedOutputMap[this->CurrentSelectedOutputUserNumber]->Get(row, col, pVAR);
|
||||||
break;
|
switch (v)
|
||||||
case VR_OUTOFMEMORY:
|
{
|
||||||
this->AddError("GetSelectedOutputValue: VR_OUTOFMEMORY Out of memory.\n");
|
case VR_OK:
|
||||||
break;
|
break;
|
||||||
case VR_BADVARTYPE:
|
case VR_OUTOFMEMORY:
|
||||||
this->AddError("GetSelectedOutputValue: VR_BADVARTYPE pVar must be initialized(VarInit) and/or cleared(VarClear).\n");
|
this->AddError("GetSelectedOutputValue: VR_OUTOFMEMORY Out of memory.\n");
|
||||||
break;
|
break;
|
||||||
case VR_INVALIDARG:
|
case VR_BADVARTYPE:
|
||||||
// not possible
|
this->AddError("GetSelectedOutputValue: VR_BADVARTYPE pVar must be initialized(VarInit) and/or cleared(VarClear).\n");
|
||||||
break;
|
break;
|
||||||
case VR_INVALIDROW:
|
case VR_INVALIDARG:
|
||||||
this->AddError("GetSelectedOutputValue: VR_INVALIDROW Row index out of range.\n");
|
// not possible
|
||||||
break;
|
break;
|
||||||
case VR_INVALIDCOL:
|
case VR_INVALIDROW:
|
||||||
this->AddError("GetSelectedOutputValue: VR_INVALIDCOL Column index out of range.\n");
|
this->AddError("GetSelectedOutputValue: VR_INVALIDROW Row index out of range.\n");
|
||||||
break;
|
break;
|
||||||
|
case VR_INVALIDCOL:
|
||||||
|
this->AddError("GetSelectedOutputValue: VR_INVALIDCOL Column index out of range.\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char buffer[120];
|
||||||
|
v = VR_INVALIDARG;
|
||||||
|
::sprintf(buffer, "GetSelectedOutputValue: VR_INVALIDARG Invalid selected-output user number %d.\n", this->CurrentSelectedOutputUserNumber);
|
||||||
|
this->AddError(buffer);
|
||||||
}
|
}
|
||||||
this->update_errors();
|
this->update_errors();
|
||||||
return v;
|
return v;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user