do shell script returns "Error of Type 1 has occurred"

I am searching for a file or directory. But when “theResult” is null, I get a applescript error - “Error of Type 1 has occurred (1).” This error occurs on the ‘set theResult…’ line of code below. Why the error? How do I avoid?
TIA


on getShellResults(theWindow)
	set theSearchString to (contents of text field "search" of theWindow as string)
	set theWD to "/Library/Application Support/"
	set theResult to do shell script ("ls -a1 " & quoted form of theWD & " | grep -i '.*" & theSearchString & ".*'")
	popTable(theResult, theWD)
end getShellResults

I’ll answer my own post…
Oops, I forgot the “Try”. I hope this helps someone else who is lacking sleep.


on getShellResults(theWindow)
   set theSearchString to (contents of text field "search" of theWindow as string)
 try
  set theWD to "/Library/Application Support/"
   set theResult to do shell script ("ls -a1 " & quoted form of theWD & " | grep -i '.*" & theSearchString & ".*'")
   popTable(theResult, theWD)
end try
end getShellResults