Fix viewer crash with corrupted MSKPs

If an MSKP fails to load, fPlayer will be null, and viewer will crash
when switching backends.

Change-Id: I68b63da21c8f7c5726b3c5bbbdcb6c17018a63ac
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/510209
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Brian Osman 2022-02-17 13:59:55 -05:00 committed by SkCQ
parent 3d97b14820
commit b5282fea23

View File

@ -190,7 +190,11 @@ void MSKPSlide::load(SkScalar, SkScalar) {
void MSKPSlide::unload() { fPlayer.reset(); }
void MSKPSlide::gpuTeardown() { fPlayer->resetLayers(); }
void MSKPSlide::gpuTeardown() {
if (fPlayer) {
fPlayer->resetLayers();
}
}
void MSKPSlide::redrawLayers() {
if (fDrawLayerID >= 0) {