From 191aee568fcba9eb1149d9a66694a7b997715f4e Mon Sep 17 00:00:00 2001 From: Florian Foinant-Willig Date: Thu, 5 Oct 2023 23:05:44 +0200 Subject: [PATCH] Fix #10910 --- src/App/Document.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/App/Document.cpp b/src/App/Document.cpp index f1b3272fee..9a45788fc6 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -833,10 +833,14 @@ Document::Document(const char* documentName) auto paramGrp {App::GetApplication().GetParameterGroupByPath( "User parameter:BaseApp/Preferences/Document")}; auto index = static_cast(paramGrp->GetInt("prefLicenseType", 0)); - const char* name = App::licenseItems.at(index).at(App::posnOfFullName); - const char* url = App::licenseItems.at(index).at(App::posnOfUrl); - std::string licenseUrl = (paramGrp->GetASCII("prefLicenseUrl", url)); - + const char* name = ""; + const char* url = ""; + std::string licenseUrl = ""; + if (index >= 0 && index < App::countOfLicenses) { + name = App::licenseItems.at(index).at(App::posnOfFullName); + url = App::licenseItems.at(index).at(App::posnOfUrl); + licenseUrl = (paramGrp->GetASCII("prefLicenseUrl", url)); + } ADD_PROPERTY_TYPE(License, (name), 0, Prop_None, "License string of the Item"); ADD_PROPERTY_TYPE( LicenseURL, (licenseUrl.c_str()), 0, Prop_None, "URL to the license text/contract");