From 5b01e4f591862a943728f1abe1cf44ac0844dbf1 Mon Sep 17 00:00:00 2001
From: Dan Kennedy <danielk1977@gmail.com>
Date: Mon, 14 Jan 2019 15:35:15 +0000
Subject: [PATCH 0765/1009] Fix a problem causing a crash if an fts5vocab table
 was created to query an fts3/4 FTS index.

https://github.com/mackyle/sqlite/commit/5b01e4f591862a943728f1abe1cf44ac0844dbf1

---
 ext/fts5/fts5_main.c          | 12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/ext/fts5/fts5_main.c b/ext/fts5/fts5_main.c
index 6fc5a90..07934eb 100644
--- a/ext/fts5/fts5_main.c
+++ b/ext/fts5/fts5_main.c
@@ -2244,13 +2244,13 @@ Fts5Index *sqlite3Fts5IndexFromCsrid(
   Fts5Config **ppConfig           /* OUT: Configuration object */
 ){
   Fts5Cursor *pCsr;
-  Fts5Table *pTab;
-
   pCsr = fts5CursorFromCsrid(pGlobal, iCsrId);
-  pTab = (Fts5Table*)pCsr->base.pVtab;
-  *ppConfig = pTab->pConfig;
-
-  return pTab->pIndex;
+  if( pCsr ){
+    Fts5Table *pTab = (Fts5Table*)pCsr->base.pVtab;
+    *ppConfig = pTab->pConfig;
+    return pTab->pIndex;
+  }
+  return 0;
 }
 
 /*
-- 
1.8.3.1

