fix: handle undefined error for pdf assetPreview (#442)
This commit is contained in:
Родитель
7fcc9ccfdb
Коммит
f041bff977
|
@ -181,25 +181,24 @@ export class PDFAsset extends React.Component<IAssetPreviewProps, IPDFAssetState
|
|||
this.pendingRelease = true;
|
||||
try {
|
||||
if (this.renderTask) {
|
||||
await this.renderTask.promise
|
||||
await this.renderTask?.promise
|
||||
this.renderTask = null;
|
||||
}
|
||||
if (this.loadingTask) {
|
||||
await this.loadingTask.promise
|
||||
await this.loadingTask?.promise
|
||||
this.loadingTask = null;
|
||||
}
|
||||
if (this.pdf) {
|
||||
await this.pdf?.cleanup();
|
||||
await this.pdf?.destroy();
|
||||
this.pdf = null;
|
||||
}
|
||||
if (this.canvas) {
|
||||
delete this.canvas;
|
||||
this.canvas = null;
|
||||
}
|
||||
} catch {
|
||||
// do nothing on rejects
|
||||
}
|
||||
if (this.pdf) {
|
||||
this.pdf.cleanup().then(() => {
|
||||
this.pdf.destroy();
|
||||
this.pdf = null;
|
||||
});
|
||||
}
|
||||
if (this.canvas) {
|
||||
delete this.canvas;
|
||||
this.canvas = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче