Welcome to the Builder Academy

Question Bug found and squashed in stock event code

More
02 Sep 2013 11:38 - 02 Sep 2013 11:39 #4241 by Ornir
I was playing with room events and noticed there is no NULL check when freeing events, like there is for character events:
Code:
case EVENT_ROOM: room = (struct room_data *) pMudEvent->pStruct; remove_from_list(pMudEvent->pEvent, room->events); if (room->events->iSize == 0) { free_list(room->events); room->events = NULL; } break;

Should be:
Code:
case EVENT_ROOM: room = (struct room_data *) pMudEvent->pStruct; remove_from_list(pMudEvent->pEvent, room->events); if (room->events && (room->events->iSize == 0)) { /* Added the null check here. - Ornir*/ free_list(room->events); room->events = NULL; } break;

Hope this helps.

Ripley/Ornir

Head Coder, LuminariMUD

Luminari - a Pathfinder/D&D inspired adventure!
www.luminarimud.com
luminarimud.com 4100
Last edit: 02 Sep 2013 11:39 by Ornir. Reason: Messed up the pasting

Please Log in or Create an account to join the conversation.

More
02 Sep 2013 22:15 #4248 by Rumble
Thanks, added.

Rumble
The Builder Academy
tbamud.com 9091
rumble@tbamud.com

Please Log in or Create an account to join the conversation.

Time to create page: 0.226 seconds