summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--main.c10
2 files changed, 7 insertions, 4 deletions
diff --git a/README.md b/README.md
index 2530caf..9e9fa71 100644
--- a/README.md
+++ b/README.md
@@ -64,6 +64,7 @@ You can try deleting/renaming your settings file as a temporary solution, to res
<table>
<tr><th>Version</th> <th>Description</th> <th>Date</th></tr>
<tr><td>0.0.0</td> <td>Initial release</td> <td>2025 Feb 26</td></tr>
+<tr><td>0.0.1</td> <td>Fix crash switching to video mode with no camera connected</td> <td>2025 Feb 26</td></tr>
</table>
## License
diff --git a/main.c b/main.c
index 603c8ad..4fc4a8f 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-#define VERSION "0.0.0"
+#define VERSION "0.0.1"
#define _GNU_SOURCE
#include <stdio.h>
@@ -1378,9 +1378,11 @@ void main() {\n\
if (state->curr_menu) break;
if (video_is_recording(state->video)) break;
state->mode = (state->mode + 1) % MODE_COUNT;
- // picture format may be different now
- PictureFormat picfmt = settings_picture_format_for_camera(state, state->camera);
- camera_set_format(state->camera, picfmt, settings_desired_framerate(state), 0, false);
+ if (state->camera) {
+ // picture format may be different now
+ PictureFormat picfmt = settings_picture_format_for_camera(state, state->camera);
+ camera_set_format(state->camera, picfmt, settings_desired_framerate(state), 0, false);
+ }
break;
case SDLK_SPACE:
if (!state->camera || state->curr_menu != 0) break;