Place after open

This commit is contained in:
Dr. Patrick Urbanke
2025-12-06 14:03:34 +01:00
parent bb3b70ad09
commit 7f3f0d1201
+1 -1
View File
@@ -14,10 +14,10 @@ Result<Nothing> save_string(const std::string& _fname, const T& _obj,
const WriteFunction& _write) {
try {
std::ofstream outfile;
outfile.open(_fname);
if (!outfile.is_open()) {
return error("Unable to open file '" + _fname + "' for writing.");
}
outfile.open(_fname);
_write(_obj, outfile);
outfile.close();
} catch (std::exception& e) {