]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/ModelAPI/ModelAPI_Expression.cpp
Salome HOME
Added fix for the non-ASCII string input in parameter name crash.
[modules/shaper.git] / src / ModelAPI / ModelAPI_Expression.cpp
index c0ffdf16d67b6061157d3c22df960ab129b1e1c2..3bba79c8c12108e9b0a1dda75baae3ee7a6640e0 100644 (file)
@@ -54,14 +54,18 @@ bool ModelAPI_Expression::isVariable(const std::string& theString)
 {
   if (theString.empty())
     return false;
-  std::string::const_iterator it = theString.begin();
-  if (!(isalpha(*it) || (*it) == '_') || it == theString.end())
-    return false;
-  it++;
-  for ( ; it != theString.end(); ++it ) {
-    if(!(isalnum(*it) || (*it) == '_')) {
+  try {
+    std::string::const_iterator it = theString.begin();
+    if (!(isalpha(*it) || (*it) == '_') || it == theString.end())
       return false;
+    it++;
+    for ( ; it != theString.end(); ++it ) {
+      if(!(isalnum(*it) || (*it) == '_')) {
+        return false;
+      }
     }
+  } catch(...) {
+    return false;
   }
   return true;
 }