Fixing function that doesn't check if object is nil.
Merge pull request #1811 from kcarcia/kc/copyedit

Fixing function that doesn't check if object is nil