Skip to content

Commit

Permalink
main: exit if invalid monitor index is specified
Browse files Browse the repository at this point in the history
Ref #4
  • Loading branch information
Lokaltog committed Mar 19, 2014
1 parent 67b1d37 commit c8dad6e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/wkline.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ main (int argc, char *argv[]) {
GtkWindow *window;
GtkLayout *layout;
GdkScreen *screen;
int monitors_num;
GdkRectangle dest;
WebKitWebView *web_view;
struct sigaction sa;
Expand Down Expand Up @@ -199,6 +200,11 @@ main (int argc, char *argv[]) {

/* get window size */
screen = gtk_window_get_screen(window);
monitors_num = gdk_screen_get_n_monitors(screen);
if (monitors_num - 1 < wkline->monitor) {
LOG_ERR("invalid monitor index '%i'", wkline->monitor);
exit(EXIT_FAILURE);
}
gdk_screen_get_monitor_geometry(screen, wkline->monitor, &dest);

wkline->width = dest.width;
Expand Down

0 comments on commit c8dad6e

Please sign in to comment.