Fix BestPathState NPE 23/69523/2
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Thu, 15 Mar 2018 10:47:28 +0000 (11:47 +0100)
committerClaudio David Gasparini <claudio.gasparini@pantheon.tech>
Thu, 15 Mar 2018 10:49:27 +0000 (10:49 +0000)
Check As Path segments are not null when
selecting best path.

Change-Id: Id4d76b9f83d957b505300aabde248978151f5b73
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
bgp/path-selection-mode/src/main/java/org/opendaylight/protocol/bgp/mode/impl/BestPathStateImpl.java

index 59e12abc8c34cbde3aadea8ca61e90c7be679376..a48b678e9c15bfabab5185823957c3fc298609d9 100644 (file)
@@ -71,7 +71,7 @@ public final class BestPathStateImpl implements BestPathState {
         }
         if (this.attributes.getAsPath() != null) {
             final List<Segments> segs = this.attributes.getAsPath().getSegments();
-            if (!segs.isEmpty()) {
+            if (segs != null && !segs.isEmpty()) {
                 this.peerAs = BesthPathStateUtil.getPeerAs(segs);
                 this.asPathLength = countAsPath(segs);
             }