From 90fbf9b54174c84be6a185718d7d836c97dc2ba3 Mon Sep 17 00:00:00 2001 From: yhirose Date: Wed, 25 Feb 2015 19:29:42 -0500 Subject: [PATCH] Fixed problem with file size 0. --- lint/peglint.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lint/peglint.cc b/lint/peglint.cc index 371aea7..9fa7028 100644 --- a/lint/peglint.cc +++ b/lint/peglint.cc @@ -18,7 +18,9 @@ bool read_file(const char* path, vector& buff) } buff.resize(static_cast(ifs.seekg(0, ios::end).tellg())); - ifs.seekg(0, ios::beg).read(&buff[0], static_cast(buff.size())); + if (!buff.empty()) { + ifs.seekg(0, ios::beg).read(&buff[0], static_cast(buff.size())); + } return true; }