From c10f68db664d372821cafe808aec3f9edc2098eb Mon Sep 17 00:00:00 2001 From: Emily Zhang Date: Thu, 18 Apr 2019 23:08:11 -0400 Subject: [PATCH] Issue-305: fix IndexError when sorting empty report --- report_builder/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/report_builder/utils.py b/report_builder/utils.py index 4e590a83..7bdbc420 100644 --- a/report_builder/utils.py +++ b/report_builder/utils.py @@ -66,6 +66,8 @@ def sort_data(data_list, display_field): display_field - report_builder.DisplayField object returns sorted data_list """ + if not data_list: + return data_list position = display_field.position is_reverse = display_field.sort_reverse # Try to inspect sample data to determine type