Fix crasher in template wrapping (introduced in 54b4f37bb).

Change-Id: Id640287cc1107d6491b850c863a1980dc111ef76
Merge "Fix crasher in template wrapping (introduced in 54b4f37bb)."