Handle when obj to be translated is None

The previous version would crash in translate_obj() when the obj parameter is
None.

Change-Id: If8b3dc0503e268a0f89ee3eec74a4483ba7973f5