Changeset 8568


Ignore:
Timestamp:
10/03/09 06:01:24 (2 years ago)
Author:
Sewi
Message:

Fixed: Could be used even in startup phase

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Padre/lib/Padre/Current.pm

    r8327 r8568  
    126126    unless ( exists $self->{editor} ) { 
    127127        my $notebook = $self->notebook; 
    128         my $selected = $notebook->GetSelection; 
    129         if ( $selected == -1 ) { 
    130             $self->{editor} = undef; 
    131         } elsif ( $selected >= $notebook->GetPageCount ) { 
    132             $self->{editor} = undef; 
    133         } else { 
    134             $self->{editor} = $notebook->GetPage($selected); 
    135             unless ( $self->{editor} ) { 
    136                 Carp::croak("Failed to find page"); 
    137             } 
    138         } 
     128        if (defined($notebook)){ 
     129            my $selected = $notebook->GetSelection; 
     130            if ( $selected == -1 ) { 
     131                $self->{editor} = undef; 
     132            } elsif ( $selected >= $notebook->GetPageCount ) { 
     133                $self->{editor} = undef; 
     134            } else { 
     135                $self->{editor} = $notebook->GetPage($selected); 
     136                unless ( $self->{editor} ) { 
     137                    Carp::croak("Failed to find page"); 
     138                } 
     139        }} 
    139140    } 
    140141    return $self->{editor}; 
Note: See TracChangeset for help on using the changeset viewer.