Skip to content

Commit 5be1da0

Browse files
committed
Fix failbit not being set if android filestream failed to open a file
1 parent 31c4b55 commit 5be1da0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

gframe/Android/file_stream.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ FileStream::FileStream(std::string filename, FileMode mode) : std::fstream() {
8080
return;
8181
}
8282
FILE* file = fileopen(filename, make_mdstring(mode.streammode));
83-
if(file == nullptr)
83+
if(file == nullptr) {
84+
setstate(ios_base::failbit);
8485
return;
86+
}
8587
// hacky things, manually set up the fstream base class members so that it's using
8688
// our file handle under the hood
8789
auto& rdbuf_ref = *rdbuf();

0 commit comments

Comments
 (0)