GetfolderItem("string") then the path is wrong

Hi Guys,
I am sure we have all done it regardless of the OS.

dim f as folderitem = getfolderitem (“c:\here\there\everywhere\test.txt”)

this works great however if you have renamed a folder or have given the incorrect path then you get a nil object exception

For example
dim f as folderitem = getfolderitem (“c:\otHere\there\everywhere\test.txt”)
dim f as folderitem = getfolderitem (“c:\here\there\WasHere\everywhere\test.txt”)

If the path is incorrect then “f.exists” crashes the app or WEB app.
If only the file name is incorrect the “f.exists” returns FALSE - no crash

Is there a smart way to check or another command like CheckFolderItem() that I have missed?

PS - Yes I have written my own method to check each step of the path, however, I thought there is probably a better way rather than re-inventing the wheel.

thanks
Damon

Check for nil before exists.

if f <> nil and f.exists then //... end if

Because of the way conditions are verified, nil will be checked first.

You are the man Michel, thanks again.