Prevent console errors for first-time builds

When a build is run the first time, certain objects are not defined
since, well, it is it's first run. Check to ensure the data exists
before traversing the data tree.