Permalink
Browse files

changed overflow handing a bit

  • Loading branch information...
1 parent 5814ec7 commit ee662b8103c262fc35416117047b2c65709c011b @VanCoding committed Mar 22, 2013
Showing with 5 additions and 6 deletions.
  1. +5 −6 lib/index.js
View
@@ -27,10 +27,9 @@ function parseNBT(buffer,index){
return val;
},
4:function(){
- var val = new Number(new i64(buffer,index).toNumber());
- if(val == Infinity || val == -Infinity){
- val.buffer = buffer.slice(index,index+7);
- }
+ var i64num = new i64(buffer,index);
+ var val = new Number(i64num.toNumber());
+ val.i64 = i64num;
index += 8;
return val;
},
@@ -134,8 +133,8 @@ function buildNBT(data){
bufs.push(b);
},
4:function(data){
- if(data.buffer){
- bufs.push(data.buffer);
+ if(data.i64){
+ bufs.push(data.i64.buffer.slice(data.i64.offset,data.i64.offset+7));
}else{
var b = new Buffer(8);
var i = new i64(b,0);

0 comments on commit ee662b8

Please sign in to comment.