From 2ece8f8f43fb2126789bd439371c0f2435008ac5 Mon Sep 17 00:00:00 2001 From: Lee Jarvis Date: Sun, 24 Apr 2011 19:31:19 +0100 Subject: [PATCH] ensure idx isnt nil here --- lib/pry/pry_instance.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pry/pry_instance.rb b/lib/pry/pry_instance.rb index 5d3b315e..0a6ed4f0 100644 --- a/lib/pry/pry_instance.rb +++ b/lib/pry/pry_instance.rb @@ -54,7 +54,7 @@ class Pry # @return [Pry] The parent of the current Pry session. def parent idx = Pry.sessions.index(self) - Pry.sessions[idx - 1] if idx > 0 + Pry.sessions[idx - 1] if idx && idx > 0 end # Execute the hook `hook_name`, if it is defined.