Fix more &vec[0] problems
This commit is contained in:
parent
73daf67c34
commit
58c0ab4747
@ -58,7 +58,7 @@ bool ReadFile(std::vector<char> &fileData, ByteString filename)
|
||||
if (f) f.seekg(0, std::ios::end);
|
||||
if (f) fileData.resize(f.tellg());
|
||||
if (f) f.seekg(0);
|
||||
if (f) f.read(&fileData[0], fileData.size());
|
||||
if (f && fileData.size()) f.read(&fileData[0], fileData.size());
|
||||
if (!f)
|
||||
{
|
||||
std::cerr << "ReadFile: " << filename << ": " << strerror(errno) << std::endl;
|
||||
|
@ -20,6 +20,11 @@ void Prefs::Read()
|
||||
Json::CharReaderBuilder rbuilder;
|
||||
std::unique_ptr<Json::CharReader> const reader(rbuilder.newCharReader());
|
||||
ByteString errs;
|
||||
if (!data.size())
|
||||
{
|
||||
std::cerr << "no json data" << std::endl;
|
||||
return;
|
||||
}
|
||||
if (!reader->parse(&data[0], &data[0] + data.size(), &root, &errs))
|
||||
{
|
||||
std::cerr << errs << std::endl;
|
||||
|
Loading…
Reference in New Issue
Block a user