Be a little more careful to handle exceptions from boost::filesystem::file_size
[dcpomatic.git] / src / lib / file_log.cc
index 5cc9c556942b4868de44a835ce305f2b0eebab12..4d6a0e6ea39fd67b7b13ea40fc7a7f475a227826 100644 (file)
@@ -69,7 +69,11 @@ FileLog::head_and_tail (int amount) const
 
        uintmax_t head_amount = amount;
        uintmax_t tail_amount = amount;
-       uintmax_t size = boost::filesystem::file_size (_file);
+       boost::system::error_code ec;
+       uintmax_t size = boost::filesystem::file_size (_file, ec);
+       if (size == static_cast<uintmax_t>(-1)) {
+               return "";
+       }
 
        if (size < (head_amount + tail_amount)) {
                head_amount = size;