[Freeciv-Dev] (PR#11237) assertion in attribute.c - cannot join to game
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=11237 >
> [lukasz@xxxxxxxxxxx - Sun Nov 28 16:25:23 2004]:
>
> Hello
>
> I've found bug(I think it's a bug) in civclient. It's longturn game.
> Today when I tried to join to it, I got the message: (using freeciv2
beta3)
>
> civclient: attribute.c:237: unserialize_hash: Assertion `inserted' failed.
>
>
> steps to reproduce:
>
> 1. launch civserver (freeciv2 or freeciv 1.14.x)
> 2. load ee.sav.gz (attached)
> 3. connect to it as 'maho'
> 4. start game
>
> result: assertion given above will appear.
>
> note: I have this bug in 1.14.1, 1.14.2 and 2.0.0.beta3 version of
freeciv.
Is this savegame from 1.14?
In any case I think this patch should avoid the problem: when it is
encountered all attributes (i.e., CMA settings) are dropped.
jason
Index: client/attribute.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/attribute.c,v
retrieving revision 1.19
diff -u -r1.19 attribute.c
--- client/attribute.c 25 Jun 2004 23:35:54 -0000 1.19
+++ client/attribute.c 30 Nov 2004 03:22:52 -0000
@@ -217,7 +217,6 @@
struct attr_key *pkey = fc_malloc(sizeof(*pkey));
void *pvalue;
int value_length;
- bool inserted;
struct data_out dout;
dio_get_uint32(&din, &value_length);
@@ -233,8 +232,14 @@
dio_put_uint32(&dout, value_length);
dio_get_memory(&din, ADD_TO_POINTER(pvalue, 4), value_length);
- inserted = hash_insert(hash, pkey, pvalue);
- assert(inserted);
+ if (!hash_insert(hash, pkey, pvalue)) {
+ freelog(LOG_ERROR, _("There has been a CMA error. "
+ "Your CMA settings may be broken."));
+ free(pvalue);
+ free(pkey);
+ hash_delete_all_entries(hash);
+ return FALSE;
+ }
}
return TRUE;
}
|
|