Fix crash in setLastUseTokenBulk
Bug: skia:3550
Change-Id: I00f83f40b30549cbfcb65e6a39afba6355d62299
Reviewed-on: https://skia-review.googlesource.com/52420
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/src/gpu/GrDrawOpAtlas.h b/src/gpu/GrDrawOpAtlas.h
index d4a81a0..2031d2e 100644
--- a/src/gpu/GrDrawOpAtlas.h
+++ b/src/gpu/GrDrawOpAtlas.h
@@ -195,9 +195,11 @@
int count = updater.fPlotsToUpdate.count();
for (int i = 0; i < count; i++) {
const BulkUseTokenUpdater::PlotData& pd = updater.fPlotsToUpdate[i];
- Plot* plot = fPages[pd.fPageIndex].fPlotArray[pd.fPlotIndex].get();
- this->makeMRU(plot, pd.fPageIndex);
- plot->setLastUseToken(token);
+ if (pd.fPageIndex < fNumPages) {
+ Plot* plot = fPages[pd.fPageIndex].fPlotArray[pd.fPlotIndex].get();
+ this->makeMRU(plot, pd.fPageIndex);
+ plot->setLastUseToken(token);
+ }
}
}