Newbie: Lisp error handling question

This is part of a bigger lisp. I am still not familiar how to use error
handling.
On occassion when I run c:t66 there is no text to be found, so it gives me
an
error ; error: bad argument type: lselsetp nil
When I run
(if txt (c:t55)(C:T66))
the lisp will crash.
How can I avoid this?
(defun C:t66 () (setq txt (cdr (assoc 1 (entget (ssname (ssget "x" '((0 .
"TEXT") (62 . 41))) 0))))))
(defun C:xtt () ;beginning of a bigger lisp
(if txt (c:t55)(C:T66))
.......
Reply to
PDI
Loading thread data ...
You need an (if ...) clause in C:t66, in case (ssget "x" '((0 . "TEXT")(62 . 41))) comes up empty (nil). ___
Reply to
Paul Turvill

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.