I expect the code to display an error and then ask the question again when the user enters no text
set tname to ""
repeat while tname is equal to ""
set tname to text returned of (display dialog ¬
"Hello" buttons {"next"} ¬
default button 1 default answer "")
end repeat
if tname is equal to "" then display dialog "error"