# HG changeset patch # User mroi # Date 1114013143 0 # Node ID d999338cab17e48cb22d1d6f245a48e3801c7c01 # Parent 7708d2fc17456cafa16767fe6e00ad9c055e6bd1 prevent races diff -r 7708d2fc1745 -r d999338cab17 dvdnav.c --- a/dvdnav.c Fri Mar 18 20:27:14 2005 +0000 +++ b/dvdnav.c Wed Apr 20 16:05:43 2005 +0000 @@ -1094,10 +1094,21 @@ */ uint32_t ops=0; + if(!this) { + printerr("Passed a NULL pointer."); + return *(user_ops_t*)&ops; + } + if(!this->started) { + printerr("Virtual DVD machine not started."); + return *(user_ops_t*)&ops; + } + + pthread_mutex_lock(&this->vm_lock); ops|=*(uint32_t*)&this->pci.pci_gi.vobu_uop_ctl; if(this->vm && this->vm->state.pgc) ops|=*(uint32_t*)&this->vm->state.pgc->prohibited_ops; + pthread_mutex_unlock(&this->vm_lock); return *(user_ops_t*)&ops; }