Salome HOME
#1083 errors in parameter
authornds <nds@opencascade.com>
Thu, 12 Nov 2015 09:06:00 +0000 (12:06 +0300)
committernds <nds@opencascade.com>
Thu, 12 Nov 2015 09:06:23 +0000 (12:06 +0300)
not initialized parameters info

src/ParametersPlugin/ParametersPlugin_Validators.cpp

index f2a9573846e25afb7472b5b0ca918708a00e1cfb..d751c36bae268a1369436ca1c95d3eacb03e4cfe 100644 (file)
@@ -27,6 +27,15 @@ bool ParametersPlugin_VariableValidator::isValid(const AttributePtr& theAttribut
                                                  std::string& theError) const
 {
   AttributeStringPtr aStrAttr = std::dynamic_pointer_cast<ModelAPI_AttributeString>(theAttribute);
+  if (!aStrAttr->isInitialized()) {
+    theError = "Attribute \"" + aStrAttr->id() + "\" is not initialized.";
+    return false;
+  }
+  bool isEmptyExpr = aStrAttr->value().empty();
+  if (isEmptyExpr) {
+    theError = "Attribute \"" + aStrAttr->id() + "\" value is empty.";
+    return false;
+  }
   if (!isVariable(aStrAttr->value())) {
     theError = "Incorrect variable name.";
     return false;
@@ -94,6 +103,10 @@ bool ParametersPlugin_ExpressionValidator::isValid(const AttributePtr& theAttrib
 
   AttributeStringPtr aStrAttr =
       std::dynamic_pointer_cast<ModelAPI_AttributeString>(theAttribute);
+  if (!aStrAttr->isInitialized()) {
+    theError = "Attribute \"" + aStrAttr->id() + "\" is not initialized.";
+    return false;
+  }
   bool isEmptyExpr = aStrAttr->value().empty();
   if (isEmptyExpr) {
     theError = "Expression is empty.";