What cause my enigne to shut down when I put it in gear

I am supose to buy 2006 honda 350 fourtrax es cheap!!! The problem is I can start the bike and it will idle fine but when I try to put it in gear it shuts down no warning lights come on. how ever when i looked at the bike I notice at first the oil temp sensor wire was broke off right where you plug it in the sensor. So my question is if the sensor is bad or gone could it cause this problem. I also know before the ower tried to fix the bike it only use to run for 15 mins then shut down and he would have to wait for it to cool so could it be as simple as a oil sensor or a bad wire going to it ?