Skip to content

Commit b452450

Browse files
committed
Fixed googless macro nil sheet key bug.
1 parent ee96df9 commit b452450

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/google_docs_macros.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def self.googless_macro(googless_wiki_content, args, nohead=false)
1111
key = escape_javascript(CGI.unescape(args[0]))
1212

1313

14+
sheet = "0"
1415
if args.length > 1
1516
# check to see if the second argument is a sheet. Otherwise, continue
1617
# assuming it's part of the query. @badidea
@@ -21,6 +22,8 @@ def self.googless_macro(googless_wiki_content, args, nohead=false)
2122
rescue ArgumentError
2223
querystart = 1
2324
sheet = "0"
25+
rescue
26+
raise "Invalid sheet code"
2427
end
2528

2629
# Queries can have commas in them, which the macro thinks are extra macro arguments.
@@ -34,6 +37,9 @@ def self.googless_macro(googless_wiki_content, args, nohead=false)
3437

3538
def self.render_spreadsheet(key, query, sheet="0", nohead=false)
3639

40+
if sheet.nil?
41+
raise "Sheet is nil"
42+
end
3743
sheet = sheet.strip()
3844

3945
if nohead != "true"

0 commit comments

Comments
 (0)