summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJose <pepone@users.noreply.github.com>2020-12-09 10:06:20 +0100
committerGitHub <noreply@github.com>2020-12-09 10:06:20 +0100
commit768a5f72646cd3e46dce2c3366f61f6a98eddbd1 (patch)
tree0e30f59769811e280e56d9ac151e431ebb6f90e8 /js
parentXcode 12.2 build fixes (#1182) (diff)
downloadice-768a5f72646cd3e46dce2c3366f61f6a98eddbd1.tar.bz2
ice-768a5f72646cd3e46dce2c3366f61f6a98eddbd1.tar.xz
ice-768a5f72646cd3e46dce2c3366f61f6a98eddbd1.zip
Better handling of undefined values (#1188)
Diffstat (limited to 'js')
-rw-r--r--js/src/Ice/Stream.js18
-rw-r--r--js/src/Ice/StreamHelpers.js4
2 files changed, 11 insertions, 11 deletions
diff --git a/js/src/Ice/Stream.js b/js/src/Ice/Stream.js
index 778a5215ddf..29ad013b5aa 100644
--- a/js/src/Ice/Stream.js
+++ b/js/src/Ice/Stream.js
@@ -2278,7 +2278,7 @@ class EncapsEncoder10 extends EncapsEncoder
//
// Object references are encoded as a negative integer in 1.0.
//
- if(v !== null)
+ if(v !== null && v !== undefined)
{
this._stream.writeInt(-this.registerValue(v));
}
@@ -2450,7 +2450,7 @@ class EncapsEncoder11 extends EncapsEncoder
writeValue(v)
{
Debug.assert(v !== undefined);
- if(v === null)
+ if(v === null || v === undefined)
{
this._stream.writeSize(0);
}
@@ -3078,7 +3078,7 @@ class OutputStream
writeBlob(v)
{
- if(v === null)
+ if(v === null || v === undefined)
{
return;
}
@@ -3121,7 +3121,7 @@ class OutputStream
writeByteSeq(v)
{
- if(v === null || v.length === 0)
+ if(v === null || v === undefined || v.length === 0)
{
this.writeSize(0);
}
@@ -3181,7 +3181,7 @@ class OutputStream
writeString(v)
{
- if(v === null || v.length === 0)
+ if(v === null || v === undefined || v.length === 0)
{
this.writeSize(0);
}
@@ -3193,14 +3193,14 @@ class OutputStream
writeProxy(v)
{
- if(v !== null)
+ if(v === null || v === undefined)
{
- v._write(this);
+ const ident = new Ice.Identity();
+ ident._write(this);
}
else
{
- const ident = new Ice.Identity();
- ident._write(this);
+ v._write(this);
}
}
diff --git a/js/src/Ice/StreamHelpers.js b/js/src/Ice/StreamHelpers.js
index 2ad1354fe6e..a170ee54640 100644
--- a/js/src/Ice/StreamHelpers.js
+++ b/js/src/Ice/StreamHelpers.js
@@ -108,7 +108,7 @@ class SequenceHelper
{
write(os, v)
{
- if(v === null || v.length === 0)
+ if(v === null || v === undefined || v.length === 0)
{
os.writeSize(0);
}
@@ -219,7 +219,7 @@ class DictionaryHelper
{
write(os, v)
{
- if(v === null || v.size === 0)
+ if(v === null || v == undefined || v.size === 0)
{
os.writeSize(0);
}