Fix some crashes in the sample

Change-Id: I8d03f8912d9a9932f8b24dd23d5f0dd21716dd0d
2 files changed