summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortrojal <trojal@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-07-10 19:19:36 +0000
committertrojal <trojal@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-07-10 19:19:36 +0000
commit21318fda56f7262a0a0225ea0230131e26f1664d (patch)
tree6fa53b5331f02967569318f27d8823e6fb5c686d /src
parenta44ba0c6c56f77c74021009fb4ca54a58dcd6773 (diff)
downloadhercules-21318fda56f7262a0a0225ea0230131e26f1664d.tar.gz
hercules-21318fda56f7262a0a0225ea0230131e26f1664d.tar.bz2
hercules-21318fda56f7262a0a0225ea0230131e26f1664d.tar.xz
hercules-21318fda56f7262a0a0225ea0230131e26f1664d.zip
Fixed bugreport:6200 Prevent server crash when releasing empty spellbooks.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16388 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/skill.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index c9d71af7f..7ed6be7c5 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -4105,6 +4105,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
for(i = SC_MAXSPELLBOOK; i >= SC_SPELLBOOK1; i--) // List all available spell to be released
if( sc->data[i] ) spell[s++] = i;
+ if ( i == 0 )
+ break;
+
i = spell[s==1?0:rand()%s];// Random select of spell to be released.
if( s && sc->data[i] ){// Now extract the data from the preserved spell
skill_id = sc->data[i]->val1;