Sau1707 / ModernBot

A Bot for Grepolis
https://sau1707.github.io/ModernBot/
MIT License
22 stars 14 forks source link

Cannot convert undefined or null to object #11

Closed Sau1707 closed 1 year ago

Sau1707 commented 1 year ago
 getCelebrationsList = (type)=>{
       const celebrationModels = uw.MM.getModels().Celebration;
       const triumphs = Object.values(celebrationModels).filter((celebration)=>celebration.attributes.celebration_type === type).map((triumph)=>triumph.attributes.town_id);
       return triumphs;
}

If there are no celebrations the celebrationModels it's null and raise an error

Sau1707 commented 1 year ago

should be fixed