Look rotation viewing vector is zero

Hi, Im using the Unity Stealth game tutorial movement system for my own game, for some reason when I first launch the game on the editor it gives me this error and the character starts walking forward, if I stop it and launch it again the error is gone and everything works perfectly, here’s the code related to character movement:

function MovementManagement (horizontal : float, vertical : float)
{
    // If there is some axis input...
    if(horizontal != 0f || vertical != 0f)
    {
        // ... set the players rotation and set the speed parameter to 1.7f.
        Rotating(horizontal, vertical);
        anim.SetFloat(hash.speedFloat, 1.7f, speedDampTime, Time.deltaTime);
    }
    else
        // Otherwise set the speed parameter to 0.
        anim.SetFloat(hash.speedFloat, 0);
}


function Rotating (horizontal : float, vertical : float)
{
    // Player can only be rotate while he's alive
    if (health >= 1)
    {
	    // Create a new vector of the horizontal and vertical inputs.
	    var targetDirection : Vector3 = new Vector3(horizontal, 0f, vertical);
	    
	    // Create a rotation based on this new vector assuming that up is the global y axis.
	    var targetRotation : Quaternion = Quaternion.LookRotation(targetDirection, Vector3.up);
	    
	    // Create a rotation that is an increment closer to the target rotation from the player's rotation.
	    var newRotation : Quaternion = Quaternion.Lerp(rigidbody.rotation, targetRotation, turnSmoothing * Time.deltaTime);
	    
	    // Change the players rotation to this new rotation.
	    rigidbody.MoveRotation(newRotation);
    }
}

The line actually giving me the error is this one:

// Create a rotation based on this new vector assuming that up is the global y axis.
var targetRotation : Quaternion = Quaternion.LookRotation(targetDirection, Vector3.up);

Im kind of a noob, here, any ideas what’s causing it?

Im going to post the answer here so that anyone with the same issue will be able to see it:

The error itself is not important, in fact, even using the Unity’s Stealth game tutorial script unchanged it pops up once in a while without affecting gameplay.

I managed to track down the issue and it appears that it was related to the joystick. Im using Unity’s Standard Asset (mobile) Single Joystick and for some reason the first time I launched the game it failed to initialize at the 0,0 coordinates and got screwed up. I managed to fix this odd behavior by simply adding a small deadzone, so when the game boots up it’ll be at 0,0 no matter what.

Anyway, I’ve given some thumbs up to both JeanSimonet and robertbu for helping me out, you guys worked really hard on this and I really appreciate the assistance!