From 911d88a2e93a88113ffca49e66d29b418dc9f526 Mon Sep 17 00:00:00 2001 From: Jeroen van Erp Date: Thu, 13 Jul 2023 13:38:53 +0200 Subject: [PATCH] Fix NPE when writing last (null) SpnegoToken (Fixes #775) Signed-off-by: Jeroen van Erp --- src/main/java/com/hierynomus/spnego/RawToken.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/hierynomus/spnego/RawToken.java b/src/main/java/com/hierynomus/spnego/RawToken.java index 5592e792..352a147c 100644 --- a/src/main/java/com/hierynomus/spnego/RawToken.java +++ b/src/main/java/com/hierynomus/spnego/RawToken.java @@ -15,8 +15,6 @@ */ package com.hierynomus.spnego; -import java.io.IOException; - import com.hierynomus.asn1.types.constructed.ASN1TaggedObject; import com.hierynomus.protocol.commons.buffer.Buffer; @@ -35,6 +33,8 @@ protected void parseTagged(ASN1TaggedObject asn1TaggedObject) throws SpnegoExcep @Override public void write(Buffer buffer) throws SpnegoException { - buffer.putRawBytes(rawToken); + if (rawToken != null) { + buffer.putRawBytes(rawToken); + } } }