Cura: Fix off-by-one error for placeholder replacement
Affected print_temperature and filament_diameter placeholders. E.g. `print_temperature2` was wrongly attempting to fetch `print_temperatures[2]` instead of `print_temperatures[1]` (0-based-indexing!) Partially fixes #1708
This commit is contained in:
parent
9e3d2bed65
commit
95e4ad82b4
1 changed files with 4 additions and 4 deletions
|
|
@ -602,8 +602,8 @@ class Profile(object):
|
|||
diameters = self._get("filament_diameter")
|
||||
if not match.group(1):
|
||||
return diameters[0]
|
||||
index = int(match.group(1))
|
||||
if index >= len(diameters):
|
||||
index = int(match.group(1)) - 1
|
||||
if index >= len(diameters) or index < 0:
|
||||
return 0.0
|
||||
return diameters[index]
|
||||
|
||||
|
|
@ -615,8 +615,8 @@ class Profile(object):
|
|||
temperatures = self._get("print_temperature")
|
||||
if not match.group(1):
|
||||
return temperatures[0]
|
||||
index = int(match.group(1))
|
||||
if index >= len(temperatures):
|
||||
index = int(match.group(1)) - 1
|
||||
if index >= len(temperatures) or index < 0:
|
||||
return 0.0
|
||||
return temperatures[index]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue