From 33a3912ca7c403b2b23c572d0d0211833a2d8c20 Mon Sep 17 00:00:00 2001 From: eidheim Date: Thu, 2 Jun 2016 13:13:41 +0200 Subject: [PATCH] Fixes to out of bounds for loops --- src/notebook.cc | 2 +- src/window.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/notebook.cc b/src/notebook.cc index 03ce883..9cf4cdf 100644 --- a/src/notebook.cc +++ b/src/notebook.cc @@ -379,7 +379,7 @@ void Notebook::toggle_split() { show_all(); } else { - for(size_t c=size();c!=static_cast(-1);--c) { + for(size_t c=size()-1;c!=static_cast(-1);--c) { auto notebook_index=get_notebook_page(c).first; if(notebook_index==1 && !close(c)) return; diff --git a/src/window.cc b/src/window.cc index 3acf2d5..b608d2f 100644 --- a/src/window.cc +++ b/src/window.cc @@ -872,7 +872,7 @@ bool Window::on_key_press_event(GdkEventKey *event) { bool Window::on_delete_event(GdkEventAny *event) { Notebook::get().save_session(); - for(size_t c=Notebook::get().size();c!=static_cast(-1);--c) { + for(size_t c=Notebook::get().size()-1;c!=static_cast(-1);--c) { if(!Notebook::get().close(c)) return true; }