json/flat: don't try to parse empty files
avoids debug assertions fetching data pointer on empty mappings
This commit is contained in:
parent
25913ac885
commit
5b58e0afa6
@ -172,6 +172,9 @@ std::vector<json::flat::item>
|
|||||||
json::flat::parse (const boost::filesystem::path &path)
|
json::flat::parse (const boost::filesystem::path &path)
|
||||||
{
|
{
|
||||||
util::mapped_file f (path.string ().c_str ());
|
util::mapped_file f (path.string ().c_str ());
|
||||||
|
if (f.empty ())
|
||||||
|
throw parse_error ("empty file");
|
||||||
|
|
||||||
return parse ((const char *)f.cbegin (), (const char*)f.cend ());
|
return parse ((const char *)f.cbegin (), (const char*)f.cend ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user