Skip to content

Commit 872bdb8

Browse files
committed
Fixed issue with assigning validator to enum parameters.
1 parent 79374c0 commit 872bdb8

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

FECore/FEParam.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -242,15 +242,17 @@ FEParam* FEParam::setUnits(const char* szunit) { m_szunit = szunit; return this;
242242
FEParam* FEParam::setEnums(const char* sz)
243243
{
244244
// count the enums
245-
int n = 0;
246-
const char* s = sz;
247-
while ((s != nullptr) && (*s != 0))
245+
if (sz && (sz[0] != '$') && (type() == FE_PARAM_INT))
248246
{
249-
s += strlen(s) + 1;
250-
n++;
247+
int n = 0;
248+
const char* s = sz;
249+
while ((s != nullptr) && (*s != 0))
250+
{
251+
s += strlen(s) + 1;
252+
n++;
253+
}
254+
SetValidator(new FEIntValidator(FEParamRange::FE_CLOSED, 0, n - 1));
251255
}
252-
253-
SetValidator(new FEIntValidator(FEParamRange::FE_CLOSED, 0, n-1));
254256
m_szenum = sz; return this;
255257
}
256258

0 commit comments

Comments
 (0)