Ticket #4839: libs_libmythdvdnav_vm.c-fix-forgotten-null-check.patch

File libs_libmythdvdnav_vm.c-fix-forgotten-null-check.patch, 1.0 KB (added by Erik Hovland <erik@…>, 16 years ago)

checks vm->vtsi for null, if it is return null for pgcit. Check returned pointer of any get_PGCIT calls now that it can return null

  • libs/libmythdvdnav/vm.c

    When getting the PGCN the nav vm might be null. But it
    
    From: Erik Hovland <erik@hovland.org>
    
    doesn't properly check.
    
    This patch fixes that.
    ---
    
     libs/libmythdvdnav/vm.c |    8 +++++++-
     1 files changed, 7 insertions(+), 1 deletions(-)
    
    diff --git a/libs/libmythdvdnav/vm.c b/libs/libmythdvdnav/vm.c
    index b0d8633..4d0f4bc 100644
    a b int vm_get_current_menu(vm_t *vm, int *menuid) { 
    633633  int pgcn;
    634634  pgcn = (vm->state).pgcN;
    635635  pgcit = get_PGCIT(vm);
     636  if (!pgcit)
     637    return 0;
     638
    636639  *menuid = pgcit->pgci_srp[pgcn - 1].entry_id & 0xf ;
    637640  return 1;
    638641}
    static pgcit_t* get_MENU_PGCIT(vm_t *vm, ifo_handle_t *h, uint16_t lang) { 
    18451848
    18461849/* Uses state to decide what to return */
    18471850static pgcit_t* get_PGCIT(vm_t *vm) {
    1848   pgcit_t *pgcit;
     1851  pgcit_t *pgcit = 0;
     1852
     1853  if (!(vm->vtsi) && ((vm->state).domain == VTS_DOMAIN || (vm->state).domain == VTSM_DOMAIN))
     1854    return pgcit;
    18491855 
    18501856  switch ((vm->state).domain) {
    18511857  case VTS_DOMAIN: