diff --git a/source/cartastraccia/actor.d b/source/cartastraccia/actor.d index 8932553..d0c5eba 100644 --- a/source/cartastraccia/actor.d +++ b/source/cartastraccia/actor.d @@ -138,6 +138,10 @@ auto res = req.get(path); string tmp = res.responseBody.data.assumeUTF; validate(tmp); + if(tmp.empty) { + throw new Exception("Empty response from " ~ feedName ~ + ", removing from feeds."); + } parseRSS(rss, tmp); } catch (Exception e) { diff --git a/source/cartastraccia/include/mrss.d b/source/cartastraccia/include/mrss.d index 44887ac..9bdff26 100644 --- a/source/cartastraccia/include/mrss.d +++ b/source/cartastraccia/include/mrss.d @@ -37,6 +37,7 @@ import std.conv : to; import core.stdc.time; +import std.range; string ZtoString(const char* c) nothrow { @@ -48,6 +49,8 @@ auto toZString(string s, ref size_t len) nothrow { + assert(!s.empty); + char[] ret = s.to!(char[]); if (ret[$-1] != '\0') ret ~= "\0".to!(char[]); diff --git a/source/cartastraccia/rss.d b/source/cartastraccia/rss.d index 0ff5c58..c48b551 100644 --- a/source/cartastraccia/rss.d +++ b/source/cartastraccia/rss.d @@ -152,7 +152,7 @@ void parseRSS(ref RSS rss, string feed) @trusted { mrss_t* rssData; - size_t len; + size_t len; auto fz = feed.toZString(len); mrss_error_t err = mrss_parse_buffer(fz, len, &rssData);