# HG changeset patch # User mroi # Date 1087750148 0 # Node ID 5124cfd4725d82a0c7007e6579476db1a3cf4461 # Parent 84f652524ecb6661b9917f40aa5214a5479ce050 fix some error conditions (fixes dvdnav_title_part_play()) diff -r 84f652524ecb -r 5124cfd4725d navigation.c --- a/navigation.c Sun Jun 20 16:47:37 2004 +0000 +++ b/navigation.c Sun Jun 20 16:49:08 2004 +0000 @@ -60,8 +60,8 @@ printerr("Passed a NULL pointer."); return DVDNAV_STATUS_ERR; } - if(!this->started) { - printerr("Virtual DVD machine not started."); + if (!this->vm->vmgi) { + printerr("Bad VM state."); return DVDNAV_STATUS_ERR; } @@ -75,8 +75,8 @@ printerr("Passed a NULL pointer."); return DVDNAV_STATUS_ERR; } - if(!this->started) { - printerr("Virtual DVD machine not started."); + if (!this->vm->vmgi) { + printerr("Bad VM state."); return DVDNAV_STATUS_ERR; } if ((title < 1) || (title > vm_get_vmgi(this->vm)->tt_srpt->nr_of_srpts) ) { @@ -103,6 +103,11 @@ pthread_mutex_unlock(&this->vm_lock); return DVDNAV_STATUS_ERR; } + if (!this->started) { + printerr("Virtual DVD machine not started."); + pthread_mutex_unlock(&this->vm_lock); + return DVDNAV_STATUS_ERR; + } if (!this->vm->state.pgc) { printerr("No current PGC."); pthread_mutex_unlock(&this->vm_lock); @@ -150,6 +155,11 @@ pthread_mutex_unlock(&this->vm_lock); return DVDNAV_STATUS_ERR; } + if (!this->started) { + /* don't report an error but be nice */ + vm_start(this->vm); + this->started = 1; + } if (!this->vm->state.pgc) { printerr("No current PGC."); pthread_mutex_unlock(&this->vm_lock);