diff --git a/frameworks/Kieker/src/mooBench/monitoredApplication/MonitoredClassManualInstrumentation.java b/frameworks/Kieker/src/mooBench/monitoredApplication/MonitoredClassManualInstrumentation.java index 1b562587181a3e422a3ea0532af8ef7581ee1b43..db631234d2daf6cb9fe7b64eec308b6dfabced30 100644 --- a/frameworks/Kieker/src/mooBench/monitoredApplication/MonitoredClassManualInstrumentation.java +++ b/frameworks/Kieker/src/mooBench/monitoredApplication/MonitoredClassManualInstrumentation.java @@ -87,11 +87,13 @@ public final class MonitoredClassManualInstrumentation implements MonitoredClass private final static void triggerAfter(final boolean newTrace) { final TraceMetadata trace = TRACEREGISTRY.getTrace(); - final String signature = SIGNATURE; - final String clazz = CLAZZ; - CTRLINST.newMonitoringRecord(new AfterOperationEvent(TIME.getTime(), trace.getTraceId(), trace.getNextOrderId(), signature, clazz)); - if (newTrace) { // close the trace - TRACEREGISTRY.unregisterTrace(); + if (null != trace) { + final String signature = SIGNATURE; + final String clazz = CLAZZ; + CTRLINST.newMonitoringRecord(new AfterOperationEvent(TIME.getTime(), trace.getTraceId(), trace.getNextOrderId(), signature, clazz)); + if (newTrace) { // close the trace + TRACEREGISTRY.unregisterTrace(); + } } } }