diff --git a/android/src/com/google/zxing/client/android/encode/EncodeActivity.java b/android/src/com/google/zxing/client/android/encode/EncodeActivity.java index 5911f2dcc..65fb89f0f 100755 --- a/android/src/com/google/zxing/client/android/encode/EncodeActivity.java +++ b/android/src/com/google/zxing/client/android/encode/EncodeActivity.java @@ -80,7 +80,8 @@ public final class EncodeActivity extends Activity { public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(Menu.NONE, SHARE_MENU, Menu.NONE, R.string.menu_share).setIcon(android.R.drawable.ic_menu_share); - int encodeNameResource = qrCodeEncoder.isUseVCard() ? R.string.menu_encode_mecard : R.string.menu_encode_vcard; + boolean useVcard = qrCodeEncoder != null && qrCodeEncoder.isUseVCard(); + int encodeNameResource = useVcard ? R.string.menu_encode_mecard : R.string.menu_encode_vcard; menu.add(Menu.NONE, ENCODE_FORMAT_MENU, Menu.NONE, encodeNameResource) .setIcon(android.R.drawable.ic_menu_sort_alphabetically); return true;