I encounter a crash/error in my game which states:
"empty pointer in vec_randomize"

As i've investigated, it would crash when I use already the two effects (water splash & dust particles), and i'm not sure why?

Hope someone could help/point me out the problem.
Here's my code:
player.c
Code:
VECTOR* vecDust = 
{
  x=0; y=0; z=0;	
}

//--------------------------------------------------------------------
// Action: Player
//--------------------------------------------------------------------
action act_player()
{	
	...	
   player = my;  //I'm the player
   player.emask |= (ENABLE_IMPACT | ENABLE_ENTITY);
   player.event = bounce_wall;
   ...
   
   while(1)
   {		     
     HandleMovement();
     HandleCamera();
     wait(1);
   }	
}

//--------------------------------------------------------------------
// Event- Hit on the wall/water
//--------------------------------------------------------------------
function bounce_wall()
{			
	if(you != NULL)
	{										
		if( /*hit in the points*/ )
		{
			//do nothing...
		}
		else  //hit in the wall & water entities
		{		
			vecDust.x = hit.x;  //i started in here so I know what vertex of the player hit the wall... hit.vertex
			vecDust.y = hit.y;
			vecDust.z = hit.z;
			
			//play some effects...
			VECTOR tempVel,tempNormal;
			vec_set(tempVel, vector(0,0,5));
			vec_set(tempNormal,normal);
			var count = 0;

			while(count < 3)
			{
				vec_randomize(tempVel,10);  //make sure the dust goes away from the impact position				
				vec_normalize(tempNormal,2 + random(5));
				vec_add(tempVel,tempNormal);
				
				if( str_cmpi(strWaterSkin,hit.texname) ) //water splash
				{				
					effect_local(splash, 1, vecDust, tempVel);					
				}
				else  //dust
				{
					effect_local(dust, 1, vecDust, tempVel);	
				}

				count += 1;
				wait(1);
			}
		}	
		wait(1);
	}		
}



environment.c
Code:
//--------------------------------------------------------------------
// helper function: sets the vector to random direction and length
//--------------------------------------------------------------------
function vec_randomize (VECTOR* vec, var range)
{     
	vec_set(vec, vector((random(5) - 1) * 0.3, (random(5) - 1) * 0.3, (random(2.5) + 1) * 0.2) );
	vec_normalize(vec,random(range));
}

//--------------------------------------------------------------------
//  DUST PARTICLE EFFECTS
//--------------------------------------------------------------------
function dust(PARTICLE *p)
{				
	p.alpha = 5 + random(5);
	p.bmap = bmp_dust;	
	p.size = 100;
	p.skill_a = vec_length(p.vel_x);	//remember the current speed	
	p.lifespan = 10;
	set(p, MOVE);
	p.event = fade_dust;	
}

//-------------------------------------------------------
function fade_dust(PARTICLE *p)
{		
	p.size += 15 * time_step;	
	p.alpha -= 0.3 * time_step;	
	if (p.alpha < 0) { p.lifespan = 0;}	
	p.skill_a -= time_step*4;	//make sure the particle gets slower while maintaining the same direction.
	vec_normalize(p.vel_x,p.skill_a);
}

//--------------------------------------------------------------------
// Water Splash
//--------------------------------------------------------------------
function splash(PARTICLE *p)
{				
	p.alpha = 5 + random(5);	
	p.bmap = bmp_splash;	
	p.size = 10;
	p.skill_b = vec_length(p.vel_x);	//remember the current speed	
	p.lifespan = 10;
	set(p, MOVE);
	p.event = fade_splash;	
}

//-------------------------------------------------------
function fade_splash(PARTICLE *p)
{		
	p.size += 15 * time_step;	
	p.alpha -= 0.3 * time_step;	
	if (p.alpha < 0) { p.lifespan = 0;}	
	p.skill_b -= time_step*4;	//make sure the particle gets slower while maintaining the same direction.
	vec_normalize(p.vel_x,p.skill_b);
}



Thanks