From b8e726d8a487b4b4c79132edb55847b2a77a3ac0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 14 Aug 2023 15:39:07 +1000 Subject: [PATCH] Catch IndexError when importing data (#5439) (#5443) * Catch IndexError when importing data * Also handle TypeError (cherry picked from commit 93e4dadb49b1cbe304ed9654af8f9d1d944c112e) Co-authored-by: Oliver --- InvenTree/part/views.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py index 25b5312a60..d236dfbe62 100644 --- a/InvenTree/part/views.py +++ b/InvenTree/part/views.py @@ -168,7 +168,11 @@ class PartImport(FileManagementFormView): for row in self.rows: # check each submitted column for idx in col_ids: - data = row['data'][col_ids[idx]]['cell'] + + try: + data = row['data'][col_ids[idx]]['cell'] + except (IndexError, TypeError): + continue if idx in self.file_manager.OPTIONAL_MATCH_HEADERS: try: