chaokunyang commented on code in PR #1686:
URL: https://github.com/apache/fury/pull/1686#discussion_r1641230740


##########
java/fury-core/src/main/java/org/apache/fury/Fury.java:
##########
@@ -310,12 +310,13 @@ private void write(MemoryBuffer buffer, Object obj) {
       buffer.writeInt32(-1); // preserve 4-byte for nativeObjects start 
offsets.
     }
     // reduce caller stack
-    if (!refResolver.writeRefOrNull(buffer, obj)) {
+    boolean isNull = refResolver.writeRefOrNull(buffer, obj);
+    if (!isNull) {
       ClassInfo classInfo = classResolver.getOrUpdateClassInfo(obj.getClass());
       classResolver.writeClass(buffer, classInfo);
       writeData(buffer, classInfo, obj);
     }
-    if (shareMeta) {
+    if (shareMeta && !isNull) {

Review Comment:
   The deserialization will still read class meta, but the offset will be -1, 
then the read will fail. Could you add an UT for such case?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to