mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-22 02:19:44 +00:00
fix potential fatal errors
This commit is contained in:
parent
6f466d52f2
commit
f246619c6b
3 changed files with 10 additions and 2 deletions
|
|
@ -152,6 +152,9 @@ std::vector<ubyte> io::read_bytes(const path& filename) {
|
|||
std::string io::read_string(const path& filename) {
|
||||
size_t size;
|
||||
auto bytes = read_bytes(filename, size);
|
||||
if (bytes == nullptr) {
|
||||
throw std::runtime_error("could not read file " + filename.string());
|
||||
}
|
||||
return std::string((const char*)bytes.get(), size);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue