Skip to content

Commit ea9d6a3

Browse files
author
wangfanghao
committed
feat(cyber): check if file exist in file interface
Change-Id: I8256fc11fe54f422b1804fdcf8bdcf3a03f5029d
1 parent 19cafde commit ea9d6a3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cyber/common/file.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ bool GetProtoFromBinaryFile(const std::string &file_name,
111111

112112
bool GetProtoFromFile(const std::string &file_name,
113113
google::protobuf::Message *message) {
114+
if (!PathExists(file_name)) {
115+
AERROR << "File does not exist! " << file_name;
116+
return false;
117+
}
114118
// Try the binary parser first if it's much likely a binary proto.
115119
static const std::string kBinExt = ".bin";
116120
if (std::equal(kBinExt.rbegin(), kBinExt.rend(), file_name.rbegin())) {

0 commit comments

Comments
 (0)