render_404 and return not working but it works if I split it in two lines

Following code works

@vendor = Vendor.find(:first, :conditions => {:status => 1, :id => params[:id]})
unless @vendor
render_404
return
end

However this code fails.

@vendor = Vendor.find(:first, :conditions => {:status => 1, :id => params[:id]})
unless @vendor
render_404 and return
end

with following error message.

Called id for nil, which would mistakenly be 4 – if you really wanted the id of nil, use object_id

I have seen people use do something and return. Why my code is failing.

@vendor = Vendor.find( :first, :conditions => [ 'status = 1 AND id =
?', params[:id] ] )