diff --git a/lib/instrumentation/index.js b/lib/instrumentation/index.js
index <HASH>..<HASH> 100644
--- a/lib/instrumentation/index.js
+++ b/lib/instrumentation/index.js
@@ -364,7 +364,7 @@ Instrumentation.prototype.addEndedSpan = function (span) {
       this._encodeAndSendSpan(span.getBufferedSpan())
     }
 
-    if (span.getParentSpan().ended || !span.isCompressionEligible()) {
+    if (!span.isCompressionEligible() || span.getParentSpan().ended) {
       const buffered = span.getBufferedSpan()
       if (buffered) {
         this._encodeAndSendSpan(buffered)
diff --git a/test/agent.test.js b/test/agent.test.js
index <HASH>..<HASH> 100644
--- a/test/agent.test.js
+++ b/test/agent.test.js
@@ -440,6 +440,7 @@ test('#startSpan()', function (t) {
     t.notEqual(span._context.traceparent.id, '00f067aa0ba902b7')
     t.strictEqual(span._context.traceparent.parentId, '00f067aa0ba902b7')
     t.strictEqual(span._context.traceparent.flags, '01')
+    span.end()
     agent.destroy()
     t.end()
   })
fix: span compression handling could crash on a span without a set parent span (#<I>)

Creating a span with a manual `{ childOf: 'some-traceparent-string' }` results

in a span without a parent `Span`. An attempt to compress it on .end()

needs to handle that.