Check for null before using AddLocalReference in ti_method
am: 0235336779

Change-Id: Iaae70cee9a9e6254578f71f1f2e469252584e4b0