summaryrefslogtreecommitdiff
path: root/session.c
diff options
context:
space:
mode:
Diffstat (limited to 'session.c')
-rw-r--r--session.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/session.c b/session.c
index 4895f34..ac76511 100644
--- a/session.c
+++ b/session.c
@@ -37,6 +37,8 @@ static void session_read_node(Ted *ted, FILE *fp) {
} else {
node->active_tab = read_u16(fp);
u16 ntabs = clamp_u16(read_u16(fp), 0, TED_MAX_TABS);
+ if (node->active_tab >= ntabs)
+ node->active_tab = 0;
for (u16 i = 0; i < ntabs; ++i) {
u16 buf_idx = read_u16(fp);
if (buf_idx >= TED_MAX_BUFFERS) continue;