Author: sveinung
Date: Fri Apr 28 12:02:56 2017
New Revision: 35316

URL: http://svn.gna.org/viewcvs/freeciv?rev=35316&view=rev
Log:
server_settings: assert that fc_funcs exists.

The common server settings module makes use of functions from fc_interface.
Make sure they are there before trying to use them.

See hrm Feature #655515

Modified:
    trunk/common/server_settings.c

Modified: trunk/common/server_settings.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/server_settings.c?rev=35316&r1=35315&r2=35316&view=diff
==============================================================================
--- trunk/common/server_settings.c      (original)
+++ trunk/common/server_settings.c      Fri Apr 28 12:02:56 2017
@@ -25,6 +25,9 @@
 ***************************************************************************/
 server_setting_id server_setting_by_name(const char *name)
 {
+  fc_assert_ret_val(fc_funcs, SERVER_SETTING_NONE);
+  fc_assert_ret_val(fc_funcs->server_setting_by_name, SERVER_SETTING_NONE);
+
   return fc_funcs->server_setting_by_name(name);
 }
 
@@ -33,6 +36,9 @@
 ***************************************************************************/
 const char *server_setting_name_get(server_setting_id id)
 {
+  fc_assert_ret_val(fc_funcs, NULL);
+  fc_assert_ret_val(fc_funcs->server_setting_name_get, NULL);
+
   return fc_funcs->server_setting_name_get(id);
 }
 
@@ -41,6 +47,9 @@
 ***************************************************************************/
 enum sset_type server_setting_type_get(server_setting_id id)
 {
+  fc_assert_ret_val(fc_funcs, sset_type_invalid());
+  fc_assert_ret_val(fc_funcs->server_setting_type_get, sset_type_invalid());
+
   return fc_funcs->server_setting_type_get(id);
 }
 
@@ -57,6 +66,8 @@
 ***************************************************************************/
 bool server_setting_value_bool_get(server_setting_id id)
 {
+  fc_assert_ret_val(fc_funcs, FALSE);
+  fc_assert_ret_val(fc_funcs->server_setting_val_bool_get, FALSE);
   fc_assert_ret_val(server_setting_type_get(id) == SST_BOOL, FALSE);
 
   return fc_funcs->server_setting_val_bool_get(id);


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to