diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Manganelo.cpp | 11 |
1 files 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; |