Skip to content

Commit f7cf3cd

Browse files
committed
fix md5file crash when not exists
1 parent d2e89a3 commit f7cf3cd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

md5.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ static char hb2hex(unsigned char hb) {
245245

246246
string md5file(const char* filename){
247247
std::FILE* file = std::fopen(filename, "rb");
248+
if (!file) {
249+
return "";
250+
}
248251
string res = md5file(file);
249252
std::fclose(file);
250253
return res;

0 commit comments

Comments
 (0)