Commits

Jakub Wilk committed cec3373

Don't segfault if opening /dev/vbi0 is not possible.

Comments (0)

Files changed (2)

 dochttx (0.2.5) UNRELEASED; urgency=low
 
   * Use autoconf for the build system.
+  * Improve error handling.
 
- -- Jakub Wilk <jwilk@jwilk.net>  Sun, 05 Aug 2012 14:00:42 +0200
+ -- Jakub Wilk <jwilk@jwilk.net>  Sun, 05 Aug 2012 14:07:56 +0200
 
 dochttx (0.2.4) unstable; urgency=low
 
 int main(void)
 {
   dochttx_locale_init();
+
+  struct dochttx_vbi_state* vbi = dochttx_vbi_open("/dev/vbi0", 8);
+  if (vbi == NULL) {
+    return EXIT_FAILURE;
+  }
+
   dochttx_ncurses_init();
  
   char lf[8];
   mvprintw(2, 43, "Looking for 100.*");
   wnoutrefresh(stdscr);
   
-  struct dochttx_vbi_state* vbi = dochttx_vbi_open("/dev/vbi0", 8);
   vbi_event_handler_register(vbi->dec, VBI_EVENT_TTX_PAGE, intercept, (void*) vbi->dec);
   
   vbi_pgno pgno = 0x100;