Changeset 901cee9 for commands.c


Ignore:
Timestamp:
Jul 4, 2011, 12:50:55 AM (10 years ago)
Author:
Jason Gross <jgross@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
4a01fc6, 95c7f0c, 401752a
Parents:
785ee77
git-author:
Jason Gross <jgross@mit.edu> (07/03/11 23:42:26)
git-committer:
Jason Gross <jgross@mit.edu> (07/04/11 00:50:55)
Message:
Don't segfault when you expunge all messages from the messagelist

When we used owl_list, trying to get an element from an empty list would
return NULL.  When we moved to GPtrArray, we dropped this checking,
without dropping the assumption that, e.g.,
 owl_view_get_element(v, owl_global_get_curmsg(&g));
works everywhere.  This commit adds the logic back in to deal with this
case.

Additionally, don't segfault on things like :unpunt -1.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    rca749a9 r901cee9  
    24982498  } else if(argc == 2) {
    24992499    /* Handle :unpunt <number> */
    2500     if(unpunt && (i=atoi(argv[1])) !=0) {
     2500    if (unpunt && (i = atoi(argv[1])) > 0) {
    25012501      i--;      /* Accept 1-based indexing */
    25022502      if (i < fl->len) {
Note: See TracChangeset for help on using the changeset viewer.