From 825e1c61f1551450b770e1a063efff35ce15ad53 Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Mon, 11 Jul 2022 19:59:20 -0400 Subject: [PATCH] check for errors in fc::read_file_contents() --- src/io/fstream.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/io/fstream.cpp b/src/io/fstream.cpp index 140452f..222a93f 100644 --- a/src/io/fstream.cpp +++ b/src/io/fstream.cpp @@ -15,9 +15,11 @@ namespace fc { { const boost::filesystem::path& bfp = filename; boost::filesystem::ifstream f( bfp, std::ios::in | std::ios::binary ); + FC_ASSERT(f, "Failed to open ${filename}", ("filename", filename)); // don't use fc::stringstream here as we need something with override for << rdbuf() std::stringstream ss; ss << f.rdbuf(); + FC_ASSERT(f, "Failed reading ${filename}", ("filename", filename)); result = ss.str(); }