Skip to content
Permalink
Browse files

from-wire's null reading should be in an unwind-protect...

  • Loading branch information...
Shinmera committed Dec 20, 2017
1 parent efe511d commit 11671c28960e91f1e902ff4d605ec61ea648ddaf
Showing with 16 additions and 16 deletions.
  1. +16 −16 wire.lisp
@@ -37,21 +37,21 @@
(let* ((*read-counter* 0)
(*read-limit* limit)
(sexpr (read-sexpr stream)))
(prog1
(typecase sexpr
(cons
(unless (typep (first sexpr) 'symbol)
(error 'malformed-wire-object :update sexpr))
(let ((class (find-class (first sexpr) NIL)))
(unless class (error 'unknown-wire-object :update sexpr))
(cond ((c2mop:subclassp class (find-class 'update))
(check-update-options sexpr)
(apply #'make-instance (first sexpr) :allow-other-keys T (rest sexpr)))
((c2mop:subclassp class (find-class 'wire-object))
(apply #'make-instance (first sexpr) :allow-other-keys T (rest sexpr)))
(T
(error 'unknown-wire-object :update sexpr)))))
(T
sexpr))
(unwind-protect
(typecase sexpr
(cons
(unless (typep (first sexpr) 'symbol)
(error 'malformed-wire-object :update sexpr))
(let ((class (find-class (first sexpr) NIL)))
(unless class (error 'unknown-wire-object :update sexpr))
(cond ((c2mop:subclassp class (find-class 'update))
(check-update-options sexpr)
(apply #'make-instance (first sexpr) :allow-other-keys T (rest sexpr)))
((c2mop:subclassp class (find-class 'wire-object))
(apply #'make-instance (first sexpr) :allow-other-keys T (rest sexpr)))
(T
(error 'unknown-wire-object :update sexpr)))))
(T
sexpr))
(loop for char = (read-char stream NIL)
until (or (not char) (char= #\Nul char))))))

0 comments on commit 11671c2

Please sign in to comment.
You can’t perform that action at this time.