# HG changeset patch # User richwareham # Date 1027668472 0 # Node ID 3b45c78f061ec53d5abe7d3201f8b5cad49d1841 # Parent 61c0ee1bbb7a11622b396343feba8a00290bfb4d Some NULL-pointer check from aschultz@cs.uni-magdeburg.de diff -r 61c0ee1bbb7a -r 3b45c78f061e searching.c --- a/searching.c Thu Jul 25 14:51:40 2002 +0000 +++ b/searching.c Fri Jul 26 07:27:52 2002 +0000 @@ -221,14 +221,24 @@ } dvdnav_status_t dvdnav_part_search(dvdnav_t *this, int part) { + + if((!this) || (!this->vm) ) + return S_ERR; + return S_OK; } dvdnav_status_t dvdnav_prev_pg_search(dvdnav_t *this) { dvd_state_t *state; + + if((!this) || (!this->vm) ) + return S_ERR; + state = &(this->vm->state); + if((!state) || (!state->pgc) ) + return S_ERR; + /* Make sure this is not the first chapter */ - if(state->pgN <= 1 ) { fprintf(stderr,"dvdnav: at first chapter. prev chapter failed.\n"); return S_ERR; @@ -243,6 +253,9 @@ dvdnav_status_t dvdnav_top_pg_search(dvdnav_t *this) { + if((!this) || (!this->vm) ) + return S_ERR; + fprintf(stderr,"dvdnav: top chapter. NOP.\n"); return S_OK; @@ -250,7 +263,14 @@ dvdnav_status_t dvdnav_next_pg_search(dvdnav_t *this) { dvd_state_t *state; + + if((!this) || (!this->vm) ) + return S_ERR; + state = &(this->vm->state); + if((!state) || (!state->pgc) ) + return S_ERR; + /* Make sure this is not the last chapter */ if(state->pgN >= state->pgc->nr_of_programs) { fprintf(stderr,"dvdnav: at last chapter. next chapter failed.\n"); @@ -267,6 +287,9 @@ dvdnav_status_t dvdnav_menu_call(dvdnav_t *this, DVDMenuID_t menu) { dvd_state_t *state; + if((!this) || (!this->vm) ) + return S_ERR; + pthread_mutex_lock(&this->vm_lock); state = &(this->vm->state); if (vm_menu_call(this->vm, menu, 0))