1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

ensure idx isnt nil here

This commit is contained in:
Lee Jarvis 2011-04-24 19:31:19 +01:00
parent 9f354b9385
commit 2ece8f8f43

View file

@ -54,7 +54,7 @@ class Pry
# @return [Pry] The parent of the current Pry session. # @return [Pry] The parent of the current Pry session.
def parent def parent
idx = Pry.sessions.index(self) idx = Pry.sessions.index(self)
Pry.sessions[idx - 1] if idx > 0 Pry.sessions[idx - 1] if idx && idx > 0
end end
# Execute the hook `hook_name`, if it is defined. # Execute the hook `hook_name`, if it is defined.