1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00

Some more error checking

This commit is contained in:
Martin Tůma 2021-07-13 19:58:12 +02:00
parent b04ac5fae3
commit 29f9fb7a68

View File

@ -143,8 +143,13 @@ void Style::line(QXmlStreamReader &reader, const Rule &rule)
if (attr.hasAttribute("stroke-dasharray")) { if (attr.hasAttribute("stroke-dasharray")) {
QStringList l(attr.value("stroke-dasharray").toString().split(',')); QStringList l(attr.value("stroke-dasharray").toString().split(','));
ri._strokeDasharray.resize(l.size()); ri._strokeDasharray.resize(l.size());
for (int i = 0; i < l.size(); i++) for (int i = 0; i < l.size(); i++) {
ri._strokeDasharray[i] = l.at(i).toDouble(); ri._strokeDasharray[i] = l.at(i).toDouble(&ok);
if (!ok || ri._strokeDasharray[i] < 0) {
reader.raiseError("invalid stroke-dasharray value");
return;
}
}
} }
if (attr.hasAttribute("stroke-linecap")) { if (attr.hasAttribute("stroke-linecap")) {
QString cap(attr.value("stroke-linecap").toString()); QString cap(attr.value("stroke-linecap").toString());