From cae6276b23cee096e033a2f013674e32614190cb Mon Sep 17 00:00:00 2001 From: Thomas Fussell Date: Wed, 14 Jun 2017 15:45:01 -0400 Subject: [PATCH] prevent exception from being thrown when a view doesn't contain window attributes --- source/detail/serialization/xlsx_consumer.cpp | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/source/detail/serialization/xlsx_consumer.cpp b/source/detail/serialization/xlsx_consumer.cpp index b356dcd2..41aee10e 100644 --- a/source/detail/serialization/xlsx_consumer.cpp +++ b/source/detail/serialization/xlsx_consumer.cpp @@ -529,10 +529,26 @@ void xlsx_consumer::read_office_document(const std::string &content_type) // CT_ "showHorizontalScroll", "showSheetTabs", "showVerticalScroll"}); workbook_view view; - view.x_window = parser().attribute("xWindow"); - view.y_window = parser().attribute("yWindow"); - view.window_width = parser().attribute("windowWidth"); - view.window_height = parser().attribute("windowHeight"); + + if (parser().attribute_present("xWindow")) + { + view.x_window = parser().attribute("xWindow"); + } + + if (parser().attribute_present("yWindow")) + { + view.y_window = parser().attribute("yWindow"); + } + + if (parser().attribute_present("windowWidth")) + { + view.window_width = parser().attribute("windowWidth"); + } + + if (parser().attribute_present("windowHeight")) + { + view.window_height = parser().attribute("windowHeight"); + } if (parser().attribute_present("tabRatio")) {