Skip to content

Commit

Permalink
fix bug: avoid npe when encode request
Browse files Browse the repository at this point in the history
  • Loading branch information
wikiwikiwiki committed Nov 30, 2020
1 parent 3fc2d10 commit f4b66c1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,16 @@ public void setHeartbeat(boolean isHeartbeat) {
}
}

public Request copy() {
Request copy = new Request(mId);
copy.mVersion = this.mVersion;
copy.mTwoWay = this.mTwoWay;
copy.mEvent = this.mEvent;
copy.mBroken = this.mBroken;
copy.mData = this.mData;
return copy;
}

@Override
public String toString() {
return "Request [id=" + mId + ", version=" + mVersion + ", twoway=" + mTwoWay + ", event=" + mEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ private String getTimeoutMessage(boolean scan) {
}

private Request getRequestWithoutData() {
Request newRequest = request;
Request newRequest = request.copy();
newRequest.setData(null);
return newRequest;
}
Expand Down

0 comments on commit f4b66c1

Please sign in to comment.