@@ -186,13 +186,28 @@ def _fill_info(self):
186186 def update_limits (self ):
187187 """Update minimal and maximal attribute limits and return tuple ``(min, max, inc)``"""
188188 if self .kind == "int" :
189- self .min = lib .GenApiIntegerGetMin (self .node )
190- self .max = lib .GenApiIntegerGetMax (self .node )
191- self .inc = lib .GenApiIntegerGetInc (self .node )
189+ try :
190+ self .min = lib .GenApiIntegerGetMin (self .node )
191+ except BaslerLibError :
192+ self .min = None
193+ try :
194+ self .max = lib .GenApiIntegerGetMax (self .node )
195+ except BaslerLibError :
196+ self .max = None
197+ try :
198+ self .inc = lib .GenApiIntegerGetInc (self .node )
199+ except BaslerLibError :
200+ self .inc = None
192201 return (self .min ,self .max ,self .inc )
193202 elif self .kind == "float" :
194- self .min = lib .GenApiFloatGetMin (self .node )
195- self .max = lib .GenApiFloatGetMax (self .node )
203+ try :
204+ self .min = lib .GenApiFloatGetMin (self .node )
205+ except BaslerLibError :
206+ self .min = None
207+ try :
208+ self .max = lib .GenApiFloatGetMax (self .node )
209+ except BaslerLibError :
210+ self .max = None
196211 return (self .min ,self .max ,self .inc )
197212 elif self .kind == "enum" :
198213 self .values = [py3 .as_str (lib .GenApiEnumerationEntryGetSymbolic (n )) for n in self ._value_nodes ]
@@ -203,12 +218,12 @@ def truncate_value(self, value):
203218 """Truncate value to lie within attribute limits"""
204219 self .update_limits ()
205220 if self .kind in ["int" ,"float" ]:
206- if value < self .min :
221+ if self . min is not None and value < self .min :
207222 value = self .min
208- elif value > self .max :
223+ elif self . max is not None and value > self .max :
209224 value = self .max
210225 else :
211- if self .inc and self .inc > 0 :
226+ if self .min is not None and self . inc and self .inc > 0 :
212227 value = ((value - self .min )// self .inc )* self .inc + self .min
213228 return value
214229
0 commit comments