mirror of
https://github.com/overleaf/overleaf.git
synced 2025-03-06 02:43:58 +00:00
Null check before regex match
This commit is contained in:
parent
d5edea77db
commit
6244d013af
1 changed files with 1 additions and 2 deletions
|
@ -51,8 +51,7 @@ define [
|
|||
range = new Range(pos.row, 0, pos.row, pos.column)
|
||||
lineUpToCursor = editor.getSession().getTextRange(range)
|
||||
commandFragment = getLastCommandFragment(lineUpToCursor)
|
||||
# if commandFragment == '\\cite{'
|
||||
if commandFragment.match(/^~?\\cite{\w*/)
|
||||
if commandFragment and commandFragment.match(/^~?\\cite{\w*/)
|
||||
result = references.keys.map (key) -> {
|
||||
caption: "\\cite{#{key}",
|
||||
snippet: "\\cite{#{key}",
|
||||
|
|
Loading…
Reference in a new issue