Fix #5809: Add safety check during file.write (#6292)

Co-authored-by: theseyan <sayanjyotidasworkmail@gmai.com>
This commit is contained in:
Sayan J. Das
2025-03-17 16:47:42 +05:30
committed by GitHub
parent a8ff6ecf14
commit cf3a554b15
2 changed files with 5 additions and 2 deletions
+3
View File
@@ -142,6 +142,9 @@ static IfcUtil::ArgumentType helper_fn_attribute_type(const IfcUtil::IfcBaseClas
void write(const std::string& fn) {
std::ofstream f(IfcUtil::path::from_utf8(fn).c_str());
if (!f.good()) {
throw std::runtime_error("Failed to write to path: '" + fn + "', check folder and file permissions.");
}
f << (*$self);
}