I have a variable Object foo, which is not null. I want to use foo.bar, but only if it won't bomb me with 'No such property: bar for class: Whatever'.

How should I do the following test:

if (/*test-here*/) {
  use(foo.bar)
}
Edit
Report