From: nickthetait Date: Thu, 29 Oct 2015 16:13:45 +0000 (-0600) Subject: Catch errors when print speed is set to out of range numbers X-Git-Tag: lulzbot-17.12~6 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=0ec4d0513f747c377228172cbcbd99ef54a4d3fa;p=cura.git Catch errors when print speed is set to out of range numbers Fixes T309 --- 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')