Skip to content

Commit 9cca087

Browse files
Merge pull request #217 from ltctceplrm/master
Fixed undefined property bug in openlibrary
2 parents 813c165 + 3b4dace commit 9cca087

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/api/apis/OpenLibraryAPI.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export class OpenLibraryAPI extends APIModel {
6666
new BookModel({
6767
title: result.title,
6868
englishTitle: result.title,
69-
year: result.first_publish_year.toString(),
69+
year: result.first_publish_year?.toString() ?? 'unknown',
7070
dataSource: this.apiName,
7171
id: result.key,
7272
author: result.author_name.join(', '),
@@ -111,7 +111,7 @@ export class OpenLibraryAPI extends APIModel {
111111

112112
return new BookModel({
113113
title: result.title,
114-
year: result.first_publish_year.toString(),
114+
year: result.first_publish_year?.toString() ?? 'unknown',
115115
dataSource: this.apiName,
116116
url: `https://openlibrary.org` + result.key,
117117
id: result.key,

0 commit comments

Comments
 (0)