[SMXCOMP-952]NPE in CxfBcConsumer when ServiceMix is deployed as a web application

git-svn-id: https://svn.apache.org/repos/asf/servicemix/components/branches/components-2011.02.x@1406051 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java b/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
index 8c0080a..b229fb5 100644
--- a/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
+++ b/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
@@ -418,11 +418,13 @@
                 }
                 providedBus = null;
             } else {
-                if (allBuses.keySet().contains(bus.getId())) {
-                    allBuses.remove(bus.getId());
+                if (bus != null) {
+                    if (allBuses.keySet().contains(bus.getId())) {
+                        allBuses.remove(bus.getId());
+                    }
+                    bus.shutdown(true);
+                    bus = null;
                 }
-                bus.shutdown(true);
-                bus = null;
             }
         }
         super.deactivate();