diff --git a/apps/code/editor_controller.cpp b/apps/code/editor_controller.cpp index 9634cd315..1b291689e 100644 --- a/apps/code/editor_controller.cpp +++ b/apps/code/editor_controller.cpp @@ -130,7 +130,7 @@ StackViewController * EditorController::stackController() { } void EditorController::cleanStorageEmptySpace() { - if (m_script.isNull()) { + if (m_script.isNull() || !Ion::Storage::sharedStorage()->hasRecord(m_script)) { return; } Ion::Storage::Record::Data scriptValue = m_script.value(); diff --git a/ion/include/ion/storage.h b/ion/include/ion/storage.h index 097006362..963c626bc 100644 --- a/ion/include/ion/storage.h +++ b/ion/include/ion/storage.h @@ -110,6 +110,7 @@ public: Record::ErrorStatus createRecordWithExtension(const char * baseName, const char * extension, const void * data, size_t size); // Record getters + bool hasRecord(Record r) { return pointerOfRecord(r) != nullptr; } Record recordWithExtensionAtIndex(const char * extension, int index); Record recordNamed(const char * fullName); Record recordBaseNamedWithExtension(const char * baseName, const char * extension);