You don't have to target another creature, per rules intent
As quoted in the question, green-flame blade has you make a melee attack with a weapon as part of the cantrip; on a hit, green fire also leaps to another target of your choice within 5 feet. However, it is not directly stated in the spell description whether you have to target yourself if no other creature is around, or if you can choose not to target anybody at all.
Lead rules designer Jeremy Crawford unofficially answered this question in a November 2015 tweet:
What does the leap effect of green-flame blade do if there are no hostile targets nearby? Does it jump to allies?
The intent is that you can choose no one. If you can't see, you can't choose anyway, and the flame halts
While the wording might suggest that the spell has to target another creature, Crawford clearly states that that is not the intent; you can choose not to target anyone if there is no desired secondary target in range.
This makes sense to me. Given that if the attack hits, you choose what creature the green fire leaps to, it makes sense that you can use the same control over targeting to prevent it from jumping to any creature (e.g. fizzling harmlessly against the ground, or extinguishing itself).