From 316972551f25e8c3a6906578a635cbdf33ae1bb2 Mon Sep 17 00:00:00 2001 From: cyanray Date: Sun, 23 Aug 2020 14:18:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=20=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=9C=AA=E6=A3=80=E6=9F=A5=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E6=88=90=E5=8A=9F=E6=89=93=E5=BC=80=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mirai_bot.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mirai_bot.cpp b/src/mirai_bot.cpp index d5dec19..5da002a 100644 --- a/src/mirai_bot.cpp +++ b/src/mirai_bot.cpp @@ -868,6 +868,7 @@ namespace Cyan string MiraiBot::ReadFile(const string& filename) { std::ifstream ifs(filename, std::ifstream::binary); + if (!ifs.is_open()) throw std::runtime_error("打开文件失败,请确认路径是否正确并检查文件是否存在"); std::filebuf* pbuf = ifs.rdbuf(); std::size_t size = pbuf->pubseekoff(0, ifs.end, ifs.in); pbuf->pubseekpos(0, ifs.in);