Fixed bug in AbstractFrameBytes.compareTo(), avoiding NPE when comparing
FrameBytes that have a related stream, and those that don't (such as PING).
This commit is contained in:
parent
a2a9fd59a2
commit
c9251e5c73
|
@ -1061,8 +1061,16 @@ public class StandardSession implements ISession, Parser.Listener, Handler<Stand
|
|||
@Override
|
||||
public int compareTo(FrameBytes that)
|
||||
{
|
||||
// If this.stream.priority > that.stream.priority => -1 (this.stream has less priority than that.stream)
|
||||
return that.getStream().getPriority() - getStream().getPriority();
|
||||
// FrameBytes may have or not have a related stream (for example, PING do not have a related stream)
|
||||
// FrameBytes without related streams have higher priority
|
||||
IStream thisStream = getStream();
|
||||
IStream thatStream = that.getStream();
|
||||
if (thisStream == null)
|
||||
return thatStream == null ? 0 : -1;
|
||||
if (thatStream == null)
|
||||
return 1;
|
||||
// If this.stream.priority > that.stream.priority => this.stream has less priority than that.stream
|
||||
return thatStream.getPriority() - thisStream.getPriority();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue