The photo indicates that the seat's
latch is broken, not its lock. Of course, without a latch, the lock has no purpose.
The latch isn't about safety. It's used to enable the seat to be locked. Locking the seat makes stealing the moto's fuel injection control unit, battery, tool box and whatever is in the tool box and seat cowl slightly more difficult for casual or unmotivated thieves.
If you and your moto receive a hard impact, you'll likely be launched off the seat regardless of whether the seat latches. If you and your moto are knocked down and spin together along the pavement, you might get spanked by the latchless seat. You won't notice that because you'll be preoccupied by the rush of oncoming traffic. If you are hauling at high speed across a pothole field and get launched upward off the seat after hitting a deep one, the seat might open then the seat support lock open and when you come down, you might suffer a groin injury. That sums up the latch's safety roles, as I see them .
If it were made of steel billet, the latch could be TIG-welded. It's more likely to be made of cast metal and that is why it was broken rather than bent. A product like JB Weld applied according to instructions
might repair the latch if the joint were allowed to cure for a couple of weeks. The seat post should then be aligned so it enters the latch hole cleanly. The latch/lock mechanism should be inspected to determine if it is positioned so it smoothly rotates backward to receive the seat latch post instead of getting smacked by the seat post. It should also be determined that the seat post easily rotates the latch backward then the latch springs forward into the post's receiving hole. When the lock button is pushed, the latch should release its grip on the post and the seat should open easily.
Keep your eyes open for used parts. New latch/lock assemblies might still be obtained. Check a parts fiche like
MAX BMW's.