Commit 940cd9ad authored by knowledge4igor's avatar knowledge4igor

Check passed file name

parent 7d7a3a2e
...@@ -30,6 +30,9 @@ FileBuffer::FileBuffer(const std::string& fileName) ...@@ -30,6 +30,9 @@ FileBuffer::FileBuffer(const std::string& fileName)
void void
FileBuffer::init(const char* fileName) FileBuffer::init(const char* fileName)
{ {
if (!fileName) {
throw std::runtime_error("Wrong file name");
}
int fd = open(fileName, O_RDONLY); int fd = open(fileName, O_RDONLY);
if (fd == -1) { if (fd == -1) {
throw std::runtime_error("Could not open file"); throw std::runtime_error("Could not open file");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment