Bug 953111 - Check length before initializing typedobject instance r=sfink