Moved the null test in safeDF to the front to eliminate failure in the nrow(object) calls. nrow(object) needs a non-null item.