Fix a few possible rare NPEs

git-svn-id: https://zxing.googlecode.com/svn/trunk@2335 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2012-06-29 14:58:34 +00:00
parent 024829cea4
commit b3f03373c2
2 changed files with 7 additions and 1 deletions

View file

@ -624,7 +624,10 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
if (copyToClipboard && !resultHandler.areContentsSecure()) {
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
clipboard.setText(resultHandler.getDisplayContents());
CharSequence text = resultHandler.getDisplayContents();
if (text != null) {
clipboard.setText(text);
}
}
if (source == IntentSource.NATIVE_APP_INTENT) {

View file

@ -80,6 +80,9 @@ public final class ViewfinderView extends View {
@Override
public void onDraw(Canvas canvas) {
if (cameraManager == null) {
return; // not ready yet, early draw before done configuring
}
Rect frame = cameraManager.getFramingRect();
if (frame == null) {
return;