summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-07-17 10:22:40 +0300
committerThanos Apollo <[email protected]>2024-07-17 10:22:40 +0300
commit4cd3ce6993a9b97b698537c428addf7387b13a3f (patch)
treeab357805ce5760b0bd1b88a621d6444db6b433db
parent889a1fc8691494e795520a2b51e8f8fd6183dce0 (diff)
cloze: edit: Add assertion for string or nil.
* Contents inside options/hints should be either nil or string.
-rw-r--r--gnosis.el3
1 files changed, 2 insertions, 1 deletions
diff --git a/gnosis.el b/gnosis.el
index f2b9bb9..8291a1b 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -1898,7 +1898,8 @@ SUSPEND: Suspend note, 0 for unsuspend, 1 for suspend"
(not (stringp options)))
(cl-assert (or (listp options) (stringp options)) nil "Options must be a list or a string.")
(cl-assert (gnosis-cloze-check main answer) nil "Clozes are not part of the question (main).")
- (cl-assert (>= (length answer) (length options)) nil "Hints (options) must be equal or less than clozes (answer)."))
+ (cl-assert (>= (length answer) (length options)) nil "Hints (options) must be equal or less than clozes (answer).")
+ (cl-assert (cl-every (lambda (item) (or (null item) (stringp item))) options) nil "Hints (options) must be either nil or a string."))
;; Construct the update clause for the emacsql update statement.
(cl-loop for (field . value) in `((main . ,main)
(options . ,options)