Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Fix IndexError when printint workout as PDF without any exercises

Roland Geiderc0db21a590db
diff --git a/wger/manager/pdf.py b/wger/manager/pdf.py
index 2ba7b57e8..d8c572848 100644
--- a/wger/manager/pdf.py
+++ b/wger/manager/pdf.py
@@ -425,9 +425,10 @@ def workout_view(request, id):
t = Table(data, colwidths, rowheights, style=table_style)
# Manually set the width of the columns
- t._argW[0] = 0.6 * cm # Numbering
- t._argW[1] = 9 * cm # Exercise
- t._argW[2] = 4 * cm # Repetitions
+ if len(t._argW) > 1:
+ t._argW[0] = 0.6 * cm # Numbering
+ t._argW[1] = 9 * cm # Exercise
+ t._argW[2] = 4 * cm # Repetitions
# There is nothing to output
else: