mirror of
https://github.com/Afilmory/afilmory
synced 2026-04-25 07:15:36 +00:00
fix(og.service): improve font loading error handling
- Updated the font loading logic in `OgService` to handle potential errors when checking file existence. - Utilized optional chaining to ensure that the code does not throw an error if the stat call fails, enhancing reliability during font loading. Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
@@ -94,7 +94,10 @@ export class OgService implements OnModuleDestroy {
|
||||
async loadFonts() {
|
||||
if (!this.geistFontPromise) {
|
||||
for (const candidate of GeistFontCandidates) {
|
||||
const stats = await stat(candidate)
|
||||
const stats = await stat(candidate).catch(() => null)
|
||||
if (!stats) {
|
||||
continue
|
||||
}
|
||||
if (stats.isFile()) {
|
||||
this.geistFontPromise = readFile(candidate)
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user