SentixDev / squaremarker

Simple marker addon for squaremap.
14 stars 4 forks source link

Prevent duplicate ID's from not creating marker #24

Open stumburs opened 5 months ago

stumburs commented 5 months ago

While looking at the source code I discovered a potential issue with the ID generation where a marker wouldn't get created due to it being generated only once, and if it's a duplicate of an existing ID, the user wouldn't be notified.

I'm proposing a slightly improved way of generating new ID's to ensure each new marker will definitely get one.

However, this is still far from ideal because as more markers get generated - the longer it will take to find a unique ID, and eventually (at 100k markers) it will get into an infinite loop.

Further improvements could be to use incrementing ID's or UUID's (possibly breaking current markers), but that's not up to me to decide.

Apologies if I've done something wrong. I've not used Kotlin and Gradle before.

jaakkytt commented 2 months ago

I suggest exiting the flow and notifying the user of too many markers instead of having a path in the code that allows them to reach the infinite loop.