From d284e7571b10d976c57992fbf0fc80230583fed5 Mon Sep 17 00:00:00 2001 From: Jingtao Xu Date: Tue, 16 Jan 2024 10:28:47 +0800 Subject: [PATCH] Check data carefully. --- source/clog-element.lisp | 9 ++++++--- source/clog-gui.lisp | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/source/clog-element.lisp b/source/clog-element.lisp index 26ddb1b..23ab94f 100644 --- a/source/clog-element.lisp +++ b/source/clog-element.lisp @@ -137,9 +137,12 @@ after attachment is changed to one unique to this session.")) (:documentation "Set css style.")) (defmethod (setf style) (value (obj clog-element) style-name) - (jquery-execute obj (format nil "css('~A','~A')" - style-name (escape-string value))) - value) + ;; Make sure value is a string + (let ((value (escape-string (if (stringp value) + value + (princ-to-string value))))) + (jquery-execute obj (format nil "css('~A','~A')" style-name value)) + value)) (defgeneric set-styles (clog-element style-list) (:documentation "Set css styles using a list of lists of name value pairs.")) diff --git a/source/clog-gui.lisp b/source/clog-gui.lisp index 9b11b5d..b9d80d3 100644 --- a/source/clog-gui.lisp +++ b/source/clog-gui.lisp @@ -1117,7 +1117,7 @@ interactions. Use window-end-modal to undo.")) (defmethod window-make-modal ((obj clog-gui-window)) (let ((app (connection-data-item obj "clog-gui"))) - (when (= (modal-count app) 0) + (when (and app (= (modal-count app) 0)) (setf (modal-background app) (create-div (body app) :class "w3-overlay")) (setf (display (modal-background app)) :block)) (incf (modal-count app))