Skip to content

Commit

Permalink
Merge pull request #8 from YU000jp/master
Browse files Browse the repository at this point in the history
fix 「Uncaught (in promise) TypeError: Cannot read properties of null (reading 'name')」
  • Loading branch information
usoonees authored Jan 22, 2023
2 parents 2ab760c + 2461aa0 commit 6df2d79
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ const highlightClass = "unlink-highlight"

async function getPageNames() {
const page = await logseq.Editor.getCurrentPage()
if(!page){
return
}
let pageNames = [page.name]
if (page.properties && page.properties["alias"]) {
pageNames = pageNames.concat(page.properties["alias"])
Expand All @@ -17,7 +20,9 @@ async function getPageNames() {
let prePageNames = []
async function highlightLinked() {
const curPageNames = await getPageNames()

if(!curPageNames){
return
}
// references
if (logseq.settings.highlightLinkedRefs) {
highlightLinkRef(prePageNames, curPageNames)
Expand Down

0 comments on commit 6df2d79

Please sign in to comment.