From bb9ea077dc06b8459efff7a9d971bf36a8bf754e Mon Sep 17 00:00:00 2001
From: Francois Henrotte <francois.henrotte@ulg.ac.be>
Date: Wed, 8 Feb 2012 10:31:22 +0000
Subject: [PATCH] forbids nonpositive Step

---
 Common/GmshMessage.cpp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/Common/GmshMessage.cpp b/Common/GmshMessage.cpp
index a78f0aea58..47b3e2349f 100644
--- a/Common/GmshMessage.cpp
+++ b/Common/GmshMessage.cpp
@@ -595,6 +595,7 @@ void Msg::InitializeOnelab(const std::string &name, const std::string &sockname)
 
     onelab::number o5(name + "/UseCommandLine",1);
     o5.setVisible(false);
+    _onelabClient->set(o5);
     onelab::string o(name + "/FileExtension", ".geo");
     o.setVisible(false);
     _onelabClient->set(o);
@@ -658,7 +659,15 @@ void Msg::ExchangeOnelabParameter(const std::string &key,
   else if(fopt.count("Max")){
     ps[0].setMax(fopt["Max"][0]); ps[0].setMin(-onelab::parameter::maxNumber());
   }
-  if(fopt.count("Step")) ps[0].setStep(fopt["Step"][0]);
+  //if(fopt.count("Step")) ps[0].setStep(fopt["Step"][0]);
+  if(fopt.count("Step")) {
+    int Step=fopt["Step"][0];
+    if (Step<=0) {
+      Step=1;
+      Error("Non positive Step for parameter '%s', set to 1", ps[0].getName().c_str());
+    }
+    ps[0].setStep(Step);
+  }
   if(fopt.count("Choices")) ps[0].setChoices(fopt["Choices"]);
   if(fopt.count("Visible")) ps[0].setVisible(fopt["Visible"][0] ? true : false);
   if(copt.count("Help")) ps[0].setHelp(copt["Help"][0]);
-- 
GitLab