From 8eb7d9fa9d6f01a03f8e541806550f58ec02d970 Mon Sep 17 00:00:00 2001 From: ajugo Date: Fri, 21 Apr 2023 12:00:02 +0200 Subject: [PATCH] Fix docx report generation for step tables with unknown metadata [SCI-8353] (#5330) --- app/services/reports/docx/draw_step_table.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/reports/docx/draw_step_table.rb b/app/services/reports/docx/draw_step_table.rb index e7b53d1d5..968cf7673 100644 --- a/app/services/reports/docx/draw_step_table.rb +++ b/app/services/reports/docx/draw_step_table.rb @@ -7,8 +7,8 @@ module Reports::Docx::DrawStepTable obj = self @docx.p @docx.table JSON.parse(table.contents_utf_8)['data'], border_size: Constants::REPORT_DOCX_TABLE_BORDER_SIZE do - if table.metadata - table.metadata['cells'].each do |cell| + if table.metadata.present? + table.metadata['cells']&.each do |cell| data = cell[1] next unless data.present? && data['row'].present? && data['col'].present? && data['className'].present?