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)) .......
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
You need an (if ...) clause in C:t66, in case (ssget "x" '((0 . "TEXT")(62 . 41))) comes up empty (nil). ___

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.