Handle invalid handover URI

Fixes a case where the Nfc app would crash when asked to
send a non existing file.

How to reproduce:

1. Take a screenshot in any screen.
2. Launch [Photos].
3. Long-touch the image of step 1.
4. Tap the delete icon.
5. Tap [DELETE].
6. After deleting, pull down the status bar.
7. Tap the share icon of 'Screenshot captured'.
8. Tap [Android Beam].

Change-Id: I5b2a2cba49c3e68a94716bd28d6f5825903ace16
diff --git a/NfcNci/src/com/android/nfc/BeamShareActivity.java b/NfcNci/src/com/android/nfc/BeamShareActivity.java
index cff601c..76629b8 100644
--- a/NfcNci/src/com/android/nfc/BeamShareActivity.java
+++ b/NfcNci/src/com/android/nfc/BeamShareActivity.java
@@ -143,7 +143,13 @@
                 ClipData.Item item = clipData.getItemAt(i);
                 // First try to get an Uri
                 Uri uri = item.getUri();
-                String plainText = item.coerceToText(this).toString();
+                String plainText = null;
+                try {
+                    plainText = item.coerceToText(this).toString();
+                } catch (IllegalStateException e) {
+                    if (DBG) Log.d(TAG, e.getMessage());
+                    continue;
+                }
                 if (uri != null) {
                     if (DBG) Log.d(TAG, "Found uri in ClipData.");
                     tryUri(uri);