fix(ui): wrap some possible null values (#1922)
This commit is contained in:
parent
2760e57d9a
commit
deb9f37d8f
2 changed files with 12 additions and 8 deletions
|
|
@ -43,14 +43,18 @@ export default class CanvasManager {
|
|||
this.lastTs = t;
|
||||
const playTime = t - this.delta
|
||||
if (playTime > 0) {
|
||||
const node = this.getNode(parseInt(this.nodeId, 10)) as unknown as VElement
|
||||
const canvasCtx = (node.node as HTMLCanvasElement).getContext('2d');
|
||||
const canvasEl = node.node as HTMLVideoElement;
|
||||
if (!this.videoTag.paused) {
|
||||
void this.videoTag.pause()
|
||||
const node = this.getNode(parseInt(this.nodeId, 10))
|
||||
if (node && node.node) {
|
||||
const canvasCtx = (node.node as HTMLCanvasElement).getContext('2d');
|
||||
const canvasEl = node.node as HTMLVideoElement;
|
||||
if (!this.videoTag.paused) {
|
||||
void this.videoTag.pause()
|
||||
}
|
||||
this.videoTag.currentTime = playTime/1000;
|
||||
canvasCtx?.drawImage(this.videoTag, 0, 0, canvasEl.width, canvasEl.height);
|
||||
} else {
|
||||
console.error(`CanvasManager: Node ${this.nodeId} not found`)
|
||||
}
|
||||
this.videoTag.currentTime = playTime/1000;
|
||||
canvasCtx?.drawImage(this.videoTag, 0, 0, canvasEl.width, canvasEl.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -52,7 +52,7 @@ export default function (app: App | null) {
|
|||
}
|
||||
const nowOwning: number[] = []
|
||||
const styleSheets = root.adoptedStyleSheets
|
||||
if (Symbol.iterator in styleSheets) {
|
||||
if (styleSheets && Symbol.iterator in styleSheets) {
|
||||
for (const s of styleSheets) {
|
||||
let sheetID = styleSheetIDMap.get(s)
|
||||
const init = !sheetID
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue