Code order improvement

This commit is contained in:
Dennis Postma 2025-02-05 02:27:35 +01:00
parent a5d8cf5ef9
commit 53c232d0a3

View File

@ -25,13 +25,14 @@ export default class MapRequestEvent extends BaseEvent {
const mapRepository = new MapRepository()
const map = await mapRepository.getById(data.mapId)
await mapRepository.getEntityManager().populate(map!, mapRepository.POPULATE_MAP_EDITOR as any)
if (!map) {
this.logger.info(`User ${(await this.getCharacter())!.getId()} tried to request map ${data.mapId} but it does not exist.`)
return callback(null)
}
await mapRepository.getEntityManager().populate(map, mapRepository.POPULATE_MAP_EDITOR as any)
return callback(map)
} catch (error: any) {
this.logger.error('gm:map:request error', error.message)