From 0ec4d0513f747c377228172cbcbd99ef54a4d3fa Mon Sep 17 00:00:00 2001 From: nickthetait Date: Thu, 29 Oct 2015 10:13:45 -0600 Subject: [PATCH] Catch errors when print speed is set to out of range numbers Fixes T309 --- Cura/util/validators.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Cura/util/validators.py b/Cura/util/validators.py index c72c4364..76f9f2a3 100644 --- a/Cura/util/validators.py +++ b/Cura/util/validators.py @@ -164,7 +164,13 @@ class printSpeedValidator(object): try: nozzleSize = profile.getProfileSettingFloat('nozzle_size') layerHeight = profile.getProfileSettingFloat('layer_height') - printSpeed = float(eval(self.setting.getValue().replace(',','.'), {}, {})) + raw_user_input = self.setting.getValue() + new_print_speed = raw_user_input.replace(',', '.') + try: + evaluated = eval(new_print_speed, {}, {}) #Converts unicode into numeric + except SyntaxError: #Caused by unicode string being empty + evaluated = 0.0 + printSpeed = float(evaluated) if printSpeed == 0.0: printSpeed = profile.getProfileSettingFloat('print_speed') -- 2.30.2