Fix a crash in Function.apply()

Change-Id: Ida44280b9d5408285de63841a17cd1491e52f977
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>