Changeset c7fe23e for commands.c


Ignore:
Timestamp:
Jan 20, 2011, 7:59:38 PM (11 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
b31252d
Parents:
569f0bd
git-author:
David Benjamin <davidben@mit.edu> (01/02/11 19:37:28)
git-committer:
David Benjamin <davidben@mit.edu> (01/20/11 19:59:38)
Message:
If a smartfilter fails to parse, handle the error

Otherwise we segfault. Of course, we should always succeed in creating a
filter, but we sometimes don't because of quoting bugs.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    rd275eb2 rc7fe23e  
    22912291  }
    22922292  filtname = owl_function_classinstfilt(argv[1], NULL, owl_global_is_narrow_related(&g));
    2293   owl_function_change_currentview_filter(filtname);
    2294   owl_free(filtname);
     2293  if (filtname) {
     2294    owl_function_change_currentview_filter(filtname);
     2295    owl_free(filtname);
     2296  }
    22952297  return NULL;
    22962298}
     
    23042306  }
    23052307  filtname=owl_function_zuserfilt(argv[1]);
    2306   owl_function_change_currentview_filter(filtname);
    2307   owl_free(filtname);
     2308  if (filtname) {
     2309    owl_function_change_currentview_filter(filtname);
     2310    owl_free(filtname);
     2311  }
    23082312  return NULL;
    23092313}
     
    23952399char *owl_command_colorclass(int argc, const char *const *argv, const char *buff)
    23962400{
    2397   const char *filtname;
     2401  char *filtname;
    23982402 
    23992403  if (argc < 3 || argc > 4) {
     
    24032407
    24042408  filtname=owl_function_classinstfilt(argv[1], NULL, owl_global_is_narrow_related(&g));
    2405   (void) owl_function_color_filter(filtname, argv[2], (argc == 4 ? argv[3] : NULL));
     2409  if (filtname) {
     2410    (void) owl_function_color_filter(filtname, argv[2], (argc == 4 ? argv[3] : NULL));
     2411    owl_free(filtname);
     2412  }
    24062413  return NULL;
    24072414}
Note: See TracChangeset for help on using the changeset viewer.