What is the returned value if Datahub.read() is failled?

I got error message like “Cannot read property ‘value’ of null” when resource have no valid data to return. Can I check if valid data is available from datahub before I read it?

The following code is not working. Can someone show me the right way to do it?
if (Datahub.read(’/location/coordinates/value’, 0).value != null) {
loc0 = Datahub.read(’/location/coordinates/value’, 0).value;
} else {

Removing the .value should work as the returned object is (Datahub.read(’/location/coordinates/value’, 0)
which has a .value and a .ts key if not empty, but non of them if empty

This should work as you expect:
if (Datahub.read(’/location/coordinates/value’, 0) != null)

This solved my problem. Thanks a lot for the suggestion.