From b6ba584df3378aa47f27432a591834352d31680c Mon Sep 17 00:00:00 2001 From: Bernd Wachter Date: Wed, 27 Mar 2013 19:38:18 +0200 Subject: [PATCH] Return good repo url if adaptations don't exist -- duplicating repos is better than failing --- libssu/ssu.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libssu/ssu.cpp b/libssu/ssu.cpp index 7a2dc8e..cc5fb1f 100644 --- a/libssu/ssu.cpp +++ b/libssu/ssu.cpp @@ -215,7 +215,12 @@ QString Ssu::repoUrl(QString repoName, bool rndRepo, QHash rep regex.lastIndexIn(repoName); int n = regex.cap().toInt(); - if (adaptationRepos.size() > n) { + if (!adaptationRepos.isEmpty()){ + if (adaptationRepos.size() <= n) { + ssuLog->print(LOG_INFO, "Note: repo index out of bounds, substituting 0" + repoName); + n = 0; + } + QString adaptationRepo = adaptationRepos.at(n); repoParameters.insert("adaptation", adaptationRepo); ssuLog->print(LOG_DEBUG, "Found first adaptation " + repoName);