Check the type before reusing a NumberValueEntry #21

Merged
lorenzos merged 1 commits from patch-1 into master 2018-11-02 21:11:37 +00:00

View File

@@ -1246,14 +1246,15 @@ public class LuaTable extends LuaValue implements Metatable {
} }
public Entry set(LuaValue value) { public Entry set(LuaValue value) {
if (value.type() == TNUMBER) {
LuaValue n = value.tonumber(); LuaValue n = value.tonumber();
if ( !n.isnil() ) { if (!n.isnil()) {
this.value = n.todouble(); this.value = n.todouble();
return this; return this;
} else {
return new NormalEntry( this.key, value );
} }
} }
return new NormalEntry( this.key, value );
}
public int keyindex( int mask ) { public int keyindex( int mask ) {
return hashSlot( key, mask ); return hashSlot( key, mask );