Skip to content

Commit 727cdeb

Browse files
committed
Added test to see if database present
1 parent 5229d50 commit 727cdeb

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

plugins/MUSHclient_Help.xml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
purpose="Shows the MUSHclient help file"
1111
save_state="y"
1212
date_written="2011-06-13 08:58:30"
13-
requires="4.75"
13+
date_modified="2011-07-14 08:40:00"
14+
requires="4.76"
1415
version="1.0"
1516
>
1617
<description trim="y">
@@ -283,8 +284,11 @@ function general_help (search_string, want_snippet)
283284
284285
AnsiNote (RESET)
285286
286-
assert (db, "No help database found")
287-
287+
if not db then
288+
ColourNote ("red", "", "MUSHclient help database 'help.db' not found.")
289+
return
290+
end -- if
291+
288292
local count = 0
289293
local functions = {}
290294
local general = {}
@@ -409,6 +413,19 @@ function OnPluginInstall ()
409413
db = assert (sqlite3.open(GetInfo (66) .. "help.db"))
410414
end -- if
411415
416+
local commands = false
417+
418+
-- see if commands table exists
419+
for row in db:nrows("SELECT * FROM sqlite_master WHERE type = 'table' AND name = 'commands'") do
420+
commands = true
421+
end
422+
423+
if not commands then
424+
ColourNote ("red", "", "MUSHclient help database 'help.db' not found.")
425+
db:close ()
426+
db = nil
427+
return
428+
end -- if
412429
413430
local fts4 = false
414431

0 commit comments

Comments
 (0)