Author: sveinung Date: Sun Aug 16 10:38:36 2015 New Revision: 29546 URL: http://svn.gna.org/viewcvs/freeciv?rev=29546&view=rev Log: Consistent get action structure error handling
See patch #6236 Modified: branches/S2_6/common/actions.c Modified: branches/S2_6/common/actions.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/actions.c?rev=29546&r1=29545&r2=29546&view=diff ============================================================================== --- branches/S2_6/common/actions.c (original) +++ branches/S2_6/common/actions.c Sun Aug 16 10:38:36 2015 @@ -191,9 +191,19 @@ /************************************************************************** Return the action with the given id. + + Returns NULL if no action with the given id exists. **************************************************************************/ struct action *action_by_number(int action_id) { + if (!action_id_is_valid(action_id)) { + /* Nothing to return. */ + + log_verbose("Asked for non existing action numbered %d", action_id); + + return NULL; + } + fc_assert_msg(actions[action_id], "Action %d don't exist.", action_id); return actions[action_id]; _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits