From 1f40fdb1f23797347a960aaa53f3656a4fe5f44f Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 3 Jan 2023 15:37:52 +0100 Subject: Manganelo: fix search --- src/plugins/Manganelo.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugins/Manganelo.cpp b/src/plugins/Manganelo.cpp index ef7f52c..777a4b4 100644 --- a/src/plugins/Manganelo.cpp +++ b/src/plugins/Manganelo.cpp @@ -180,6 +180,9 @@ namespace QuickMedia { } SearchResult ManganeloSearchPage::search(const std::string &str, BodyItems &result_items) { + if(str.empty()) + return SearchResult::OK; + std::string url = "https://manganato.com/getstorysearchjson"; std::string search_term = "searchword="; search_term += url_param_encode(str); @@ -192,10 +195,14 @@ namespace QuickMedia { if(json_root.isNull()) return SearchResult::OK; - if(!json_root.isArray()) + if(!json_root.isObject()) + return SearchResult::ERR; + + const Json::Value &searchlist_json = json_root["searchlist"]; + if(!searchlist_json.isArray()) return SearchResult::ERR; - for(const Json::Value &child : json_root) { + for(const Json::Value &child : searchlist_json) { if(!child.isObject()) continue; -- cgit v1.2.3