mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Terminate RGBGFX when opening a file fails
`std::filebuf::open`'s result must be checked, though that's not obvious.
This commit is contained in:
@@ -254,7 +254,9 @@ static void registerInput(char const *arg) {
|
||||
*/
|
||||
static std::vector<size_t> readAtFile(std::string const &path, std::vector<char> &argPool) {
|
||||
std::filebuf file;
|
||||
file.open(path, std::ios_base::in);
|
||||
if (!file.open(path, std::ios_base::in)) {
|
||||
fatal("Error reading @%s: %s", path.c_str(), strerror(errno));
|
||||
}
|
||||
|
||||
static_assert(decltype(file)::traits_type::eof() == EOF,
|
||||
"isblank(char_traits<...>::eof()) is UB!");
|
||||
|
||||
Reference in New Issue
Block a user