As above! There is a safety circuit to cut the engine out if the side stand is down and bike in gear.There's a switch that the kickstand activates, over time it gets dirty inside and gets stuck.
Have someone hold the bike upright.
You'll see it down by the kickstand.
Spray wd40 into it while pushing the switch in and out.