diff --git a/source/detail/serialization/xlsx_consumer.cpp b/source/detail/serialization/xlsx_consumer.cpp index 2d2ebc85..1d84949e 100644 --- a/source/detail/serialization/xlsx_consumer.cpp +++ b/source/detail/serialization/xlsx_consumer.cpp @@ -244,6 +244,11 @@ xlnt::detail::Cell parse_cell(xlnt::row_t row_arg, xml::parser *parser) throw xlnt::exception("unexcpected XML parsing event"); } } + // Prevents unhandled exceptions from being triggered. + for (auto &attr : parser->attribute_map()) + { + (void)attr; + } } return c; } diff --git a/tests/data/Issue503_external_link.xlsx b/tests/data/Issue503_external_link.xlsx new file mode 100755 index 00000000..d7aea822 Binary files /dev/null and b/tests/data/Issue503_external_link.xlsx differ diff --git a/tests/workbook/serialization_test_suite.cpp b/tests/workbook/serialization_test_suite.cpp index b6c29581..fb4fc377 100644 --- a/tests/workbook/serialization_test_suite.cpp +++ b/tests/workbook/serialization_test_suite.cpp @@ -23,28 +23,28 @@ #include +#include #include #include -#include -#include -#include +#include #include +#include #include #include -#include +#include #include #include #include #include #include +#include #include #include #include -#include #include +#include #include #include -#include #include #include #include @@ -94,6 +94,7 @@ public: register_test(test_Issue445_inline_str_load); register_test(test_Issue445_inline_str_streaming_read); register_test(test_Issue492_stream_empty_row); + register_test(test_Issue503_external_link_load); } bool workbook_matches_file(xlnt::workbook &wb, const xlnt::path &file) @@ -715,7 +716,7 @@ public: void test_load_save_german_locale() { - /* std::locale current(std::locale::global(std::locale("de-DE"))); + /* std::locale current(std::locale::global(std::locale("de-DE"))); test_round_trip_rw_custom_heights_widths(); std::locale::global(current);*/ } @@ -754,5 +755,15 @@ public: xlnt_assert_equals(wbr.read_cell().reference(), "B4"); xlnt_assert(!wbr.has_cell()); } + + void test_Issue503_external_link_load() + { + xlnt::workbook wb; + wb.load(path_helper::test_file("Issue503_external_link.xlsx")); + auto ws = wb.active_sheet(); + auto cell = ws.cell("A1"); + xlnt_assert_equals(cell.value(), std::string("WDG_IC_00000003.aut")); + } }; + static serialization_test_suite x;