Try to avoid another clipboard-related NPE

git-svn-id: https://zxing.googlecode.com/svn/trunk@2564 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2013-01-20 00:02:55 +00:00
parent 0302080139
commit 0983aec832

View file

@ -598,7 +598,12 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
CharSequence text = resultHandler.getDisplayContents(); CharSequence text = resultHandler.getDisplayContents();
if (text != null) { if (text != null) {
clipboard.setText(text); try {
clipboard.setText(text);
} catch (NullPointerException npe) {
// Some kind of bug inside the clipboard implementation, not due to null input
Log.w(TAG, "Clipboard bug", npe);
}
} }
} }