jcs
/subtext
/amendments
/551
settings: When saving an empty template, just delete it
jcs made amendment 551 10 months ago
--- settings.c Mon Aug 28 09:40:55 2023
+++ settings.c Fri Nov 17 12:08:22 2023
@@ -599,8 +599,13 @@ view_editor_save(struct focusable *focusable, EventRec
}
}
- bile_write(db->bile, DB_TEXT_TYPE, view_editor->view_id,
- *(*(view_editor->te))->hText, len);
+ /* bile doesn't like zero-sized objects */
+ if (len == 0)
+ bile_delete(db->bile, DB_TEXT_TYPE, view_editor->view_id,
+ BILE_DELETE_FLAG_PURGE);
+ else
+ bile_write(db->bile, DB_TEXT_TYPE, view_editor->view_id,
+ *(*(view_editor->te))->hText, len);
HUnlock((*(view_editor->te))->hText);
HUnlock(view_editor->te);