template_qml: check the length of method outputs at runtime

Change-Id: I49d3417c858d1a1106ac5fec705efd4be3772619