diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNoteRecordingMenuFullScreen.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNoteRecordingMenuFullScreen.java index 9103cc6646..34d5cf8a5f 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNoteRecordingMenuFullScreen.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNoteRecordingMenuFullScreen.java @@ -73,11 +73,13 @@ public class AudioVideoNoteRecordingMenuFullScreen extends AudioVideoNoteRecordi } public WeakReference findMenuFragment() { - Fragment fragment = getMapActivity().getSupportFragmentManager().findFragmentByTag(AudioVideoNoteRecordingMenuFullScreenFragment.TAG); - if (fragment != null && !fragment.isDetached()) { - return new WeakReference<>((AudioVideoNoteRecordingMenuFullScreenFragment) fragment); - } else { - return null; + MapActivity mapActivity = getMapActivity(); + if (mapActivity != null) { + Fragment fragment = mapActivity.getSupportFragmentManager().findFragmentByTag(AudioVideoNoteRecordingMenuFullScreenFragment.TAG); + if (fragment != null && !fragment.isDetached()) { + return new WeakReference<>((AudioVideoNoteRecordingMenuFullScreenFragment) fragment); + } } + return null; } } diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java index f6721462bd..a386fa9040 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java @@ -1913,20 +1913,21 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { public synchronized void shootAgain() { cancelPhotoTimer(); - cam.cancelAutoFocus(); photoRawData = null; + if (cam != null) { + try { + cam.cancelAutoFocus(); + cam.stopPreview(); + cam.startPreview(); + internalShoot(); - try { - cam.stopPreview(); - cam.startPreview(); - internalShoot(); - - } catch (Exception e) { - logErr(e); - closeRecordingMenu(); - closeCamera(); - finishRecording(); - e.printStackTrace(); + } catch (Exception e) { + logErr(e); + closeRecordingMenu(); + closeCamera(); + finishRecording(); + e.printStackTrace(); + } } }