Skip to content

Commit e070b64

Browse files
authored
Shutdown gradually if not able to initialize display (#11)
1 parent d6b1ae2 commit e070b64

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/drm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ int modeset_prepare(int fd, struct modeset_output *output_list, uint16_t mode_wi
539539

540540
*output_list = *out;
541541
}
542-
if (!output_list) {
542+
if (!out) {
543543
fprintf(stderr, "couldn't create any outputs\n");
544544
return -1;
545545
}

src/main.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,11 @@ int main(int argc, char **argv)
685685
assert(drm_fd >= 0);
686686
output_list = (struct modeset_output *)malloc(sizeof(struct modeset_output));
687687
ret = modeset_prepare(drm_fd, output_list, mode_width, mode_height, mode_vrefresh);
688-
assert(!ret);
688+
if (ret) {
689+
fprintf(stderr,
690+
"cannot initialize display. Is display connected? Is --screen-mode correct?\n");
691+
return -2;
692+
}
689693

690694
////////////////////////////////// MPI SETUP
691695
MppPacket packet;

0 commit comments

Comments
 (0)