Skip to content

Commit 11c3b09

Browse files
committed
fix: Cannot read properties of undefined
1 parent 8d4a479 commit 11c3b09

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/runtime/query/match/pipeline-legacy.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ export function createPipelineFetcherLegacy<T> (getContentsList: () => Promise<T
1111

1212
if (params.surround) {
1313
// @ts-ignore
14-
return result.surround
14+
return result?.surround
1515
}
1616

17-
if ((result as any).dirConfig) {
17+
if ((result as any)?.dirConfig) {
1818
result.result = {
1919
_path: (result as any).dirConfig?._path,
2020
...(result.result as T),
2121
_dir: (result as any).dirConfig
2222
}
2323
}
2424

25-
return result.result as T | T[]
25+
return result?.result as T | T[]
2626
}
2727
}

src/runtime/query/query.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function createQuery <T = ParsedContent> (fetcher: ContentQueryFetcher<T>
3535
return result.surround
3636
}
3737

38-
if ((result as any).dirConfig) {
38+
if ((result as any)?.dirConfig) {
3939
result.result = {
4040
_path: (result as any).dirConfig?._path,
4141
...(result.result as T),

0 commit comments

Comments
 (0)