check if allocation failed and return NULL (not found) in case

avoid crashing if the system memory is limited and a given object can't be loaded