From 77304040ade8c45302cc3049eac302ff78bb3982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Mon, 2 Sep 2019 10:30:54 +0200 Subject: [PATCH] [ion] Storage: fix crash due to wrong assertion Python tries to import files without extension, it should not crash but return an empty Record. --- ion/src/shared/storage.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ion/src/shared/storage.cpp b/ion/src/shared/storage.cpp index d8f12df2c..27d8a7326 100644 --- a/ion/src/shared/storage.cpp +++ b/ion/src/shared/storage.cpp @@ -43,8 +43,11 @@ Storage::Record::Record(const char * fullName) { return; } const char * dotChar = UTF8Helper::CodePointSearch(fullName, k_dotChar); - assert(*dotChar != 0); - assert(*(dotChar+1) != 0); // Assert there is an extension + // If no extension, return empty record + if (*dotChar == 0 || *(dotChar+1) == 0) { + m_fullNameCRC32 = 0; + return; + } new (this) Record(fullName, dotChar - fullName, dotChar+1, (fullName + strlen(fullName)) - (dotChar+1)); }