Check for null before using AddLocalReference in ti_method am: 0235336779
am: 3a0eb06b83

Change-Id: I2ca78a30c9e16f69d7e537643a1c206dfff8aae5