mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Avoid indexes out of range when processing v1 updated session data
This commit is contained in:
parent
8c81f26384
commit
b447226bc1
@ -102,12 +102,23 @@ void RequestMapper::loadSessionV1(HttpRequest &request, HttpResponse &response)
|
||||
QList<QString> data = postData.split("\n");
|
||||
|
||||
if (data.length() > 2) {
|
||||
ySession->setDeviceType(data.at(0).split(":").at(1));
|
||||
ySession->setDisplayType(data.at(1).split(":").at(1));
|
||||
QList<QString> comics = data.at(2).split(":").at(1).split("\t");
|
||||
auto deviceTypeData = data.at(0).split(":");
|
||||
if (deviceTypeData.length() == 2) {
|
||||
ySession->setDeviceType(deviceTypeData.at(1));
|
||||
}
|
||||
|
||||
auto displayTypeData = data.at(1).split(":");
|
||||
if (displayTypeData.length() == 2) {
|
||||
ySession->setDisplayType(displayTypeData.at(1));
|
||||
}
|
||||
|
||||
auto comicsData = data.at(2).split(":");
|
||||
if (comicsData.length() == 2) {
|
||||
QList<QString> comics = comicsData.at(1).split("\t");
|
||||
foreach (QString hash, comics) {
|
||||
ySession->setComicOnDevice(hash);
|
||||
}
|
||||
}
|
||||
} else //values by default, only for debug purposes.
|
||||
{
|
||||
ySession->setDeviceType("ipad");
|
||||
|
Loading…
Reference in New Issue
Block a user