aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-10-02 03:53:39 +0200
committerdec05eba <dec05eba@protonmail.com>2021-10-02 03:53:39 +0200
commit7f8ef9f591ce85cfac49b71b5ff2bc8293e0d57c (patch)
tree02e2363c47a1c69be7ba87cbe985d4ab182312cb /src
parent275c6c9d801fffbf30fc702c1f683e519f66798f (diff)
Mangadex: fix oneshots (without chapter name) not being listed in chapters page
Diffstat (limited to 'src')
-rw-r--r--src/plugins/Mangadex.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/plugins/Mangadex.cpp b/src/plugins/Mangadex.cpp
index a232d65..e57c6cd 100644
--- a/src/plugins/Mangadex.cpp
+++ b/src/plugins/Mangadex.cpp
@@ -191,7 +191,8 @@ namespace QuickMedia {
if(!data_list_json.isArray())
return PluginResult::ERR;
- const char *prev_chapter = nullptr;
+ std::string prev_chapter;
+ std::string chapter;
for(const Json::Value &data_json : data_list_json) {
if(!data_json.isObject())
continue;
@@ -209,18 +210,20 @@ namespace QuickMedia {
continue;
const Json::Value &chapter_json = attributes_json["chapter"];
- if(!chapter_json.isString())
- continue;
+ if(chapter_json.isString())
+ chapter = chapter_json.asString();
+ else
+ chapter = "0";
- if(prev_chapter && strcmp(prev_chapter, chapter_json.asCString()) == 0)
+ if(strcmp(prev_chapter.c_str(), chapter.c_str()) == 0)
continue;
const Json::Value &hash_json = attributes_json["hash"];
if(!hash_json.isString())
continue;
- prev_chapter = chapter_json.asCString();
- std::string title = "Ch. " + chapter_json.asString();
+ std::string title = "Ch. " + chapter;
+ prev_chapter = std::move(chapter);
const Json::Value &title_json = attributes_json["title"];
if(title_json.isString() && title_json.asCString()[0] != '\0')
title += " - " + title_json.asString();