Allowed to construct a dbus::BusConnection object with NULL g_connection (just like dbus::Proxy) to fix TODO in the GetPrivateConnection function.

BUG=none

Review URL: http://codereview.chromium.org/2842019
diff --git a/chromeos/dbus/dbus.h b/chromeos/dbus/dbus.h
index 4775867..9ac1a1f 100644
--- a/chromeos/dbus/dbus.h
+++ b/chromeos/dbus/dbus.h
@@ -34,11 +34,14 @@
   typedef ::DBusGConnection* value_type;
 
   BusConnection(const BusConnection& x)
-      : object_(dbus_g_connection_ref(x.object_)) {
+      : object_(x.object_) {
+    if (object_)
+      ::dbus_g_connection_ref(object_);
   }
 
   ~BusConnection() {
-    ::dbus_g_connection_unref(object_);
+    if (object_)
+      ::dbus_g_connection_unref(object_);
   }
 
   BusConnection& operator=(BusConnection x) {
@@ -51,6 +54,14 @@
     return object_;
   }
 
+  operator bool() const {
+    return object_;
+  }
+
+  bool HasConnection() const {
+    return object_;
+  }
+
  private:
   friend void swap(BusConnection& x, BusConnection& y);
 
@@ -61,7 +72,6 @@
   // Constructor takes ownership
   explicit BusConnection(::DBusGConnection* x)
       : object_(x) {
-    DCHECK(object_) << "Constructing BusConnection with NULL object.";
   }
 
   value_type object_;