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/libs/libmythdvdnav/vm.c
+++ b/libs/libmythdvdnav/vm.c
@@ -633,6 +633,9 @@ int vm_get_current_menu(vm_t *vm, int *menuid) {
   int pgcn;
   pgcn = (vm->state).pgcN;
   pgcit = get_PGCIT(vm);
+  if (!pgcit)
+    return 0;
+
   *menuid = pgcit->pgci_srp[pgcn - 1].entry_id & 0xf ;
   return 1;
 }
@@ -1845,7 +1848,10 @@ static pgcit_t* get_MENU_PGCIT(vm_t *vm, ifo_handle_t *h, uint16_t lang) {
 
 /* Uses state to decide what to return */
 static pgcit_t* get_PGCIT(vm_t *vm) {
-  pgcit_t *pgcit;
+  pgcit_t *pgcit = 0;
+
+  if (!(vm->vtsi) && ((vm->state).domain == VTS_DOMAIN || (vm->state).domain == VTSM_DOMAIN))
+    return pgcit;
   
   switch ((vm->state).domain) {
   case VTS_DOMAIN:
