I was working on a 3D text and when i try to color the Mesh. the Text enviroment crashes

[PHP]bool colour_font(ID3DXMesh **mesh){
my_vertex *v;
if((*mesh)->LockVertexBuffer(0, (void**)&v) != D3D_OK)
{
return false;
}
for(unsigned int i = 0; i < (*mesh)->GetNumVertices(); ++i)
v[i].colour = 0xFFFF0000;


(*mesh)->UnlockVertexBuffer();

return true;

}[/PHP]