I have no idea what was happening.
One early theory was that the second part of the bottom line was being erroneously rounded up on rare occasions leading to a negative SendDistance value. Although when i tested it, i discovered that the game is infact perfectly fine with negative SendDistance values.
Changing the second 1500 to 1499, fixed the crashes. Strange.
The code scans through the planets on the map, and then changes the distance they can send seedlings based on the day/night cycle (Plants need sunlight!) and how many plants are currently on the planet.