Merge "Modified not to occur NPE when handle call of failed connection"
diff --git a/src/com/android/server/telecom/ConnectionServiceWrapper.java b/src/com/android/server/telecom/ConnectionServiceWrapper.java
index 4018d54..3a4d143 100755
--- a/src/com/android/server/telecom/ConnectionServiceWrapper.java
+++ b/src/com/android/server/telecom/ConnectionServiceWrapper.java
@@ -2091,11 +2091,11 @@
             // failure to connect; we handle all failures uniformly
             Call foundCall = mCallIdMapper.getCall(callId);
 
-            if (connection.getConnectTimeMillis() != 0) {
-                foundCall.setConnectTimeMillis(connection.getConnectTimeMillis());
-            }
-
             if (foundCall != null) {
+                if (connection.getConnectTimeMillis() != 0) {
+                    foundCall.setConnectTimeMillis(connection.getConnectTimeMillis());
+                }
+
                 // The post-dial digits are created when the call is first created.  Normally
                 // the ConnectionService is responsible for stripping them from the address, but
                 // since a failed connection will not have done this, we could end up with duplicate