Changeset 156


Ignore:
Timestamp:
10/17/02 13:55:51 (21 years ago)
Author:
piso
Message:

getNextUndeleted(), getPreviousUndeleted(): avoid NPE.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/j/mail/Mailbox.java

    r93 r156  
    33 *
    44 * Copyright (C) 2000-2002 Peter Graves
    5  * $Id: Mailbox.java,v 1.2 2002-10-11 01:42:37 piso Exp $
     5 * $Id: Mailbox.java,v 1.3 2002-10-17 13:55:51 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    359359            }
    360360        }
    361         for (line = line.next(); line != null; line = line.next()) {
    362             if (line instanceof MailboxLine) {
    363                 MailboxEntry maybe = ((MailboxLine)line).getMailboxEntry();
    364                 if (!maybe.isDeleted())
    365                     return maybe;
     361        if (line != null) {
     362            for (line = line.next(); line != null; line = line.next()) {
     363                if (line instanceof MailboxLine) {
     364                    MailboxEntry maybe = ((MailboxLine)line).getMailboxEntry();
     365                    if (!maybe.isDeleted())
     366                        return maybe;
     367                }
    366368            }
    367369        }
     
    378380            }
    379381        }
    380         for (line = line.previous(); line != null; line = line.previous()) {
    381             if (line instanceof MailboxLine) {
    382                 MailboxEntry maybe = ((MailboxLine)line).getMailboxEntry();
    383                 if (!maybe.isDeleted())
    384                     return maybe;
     382        if (line != null) {
     383            for (line = line.previous(); line != null; line = line.previous()) {
     384                if (line instanceof MailboxLine) {
     385                    MailboxEntry maybe = ((MailboxLine)line).getMailboxEntry();
     386                    if (!maybe.isDeleted())
     387                        return maybe;
     388                }
    385389            }
    386390        }
Note: See TracChangeset for help on using the changeset viewer.