Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(627)

Unified Diff: src/objects-printer.cc

Issue 2656903003: PrintFixedArrayElements should avoid peeking into empty arrays. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-printer.cc
diff --git a/src/objects-printer.cc b/src/objects-printer.cc
index 690d3ec93aa83eb3a713238e291d69c1005f7e93..015d79b9c4146cdef9740e05704bb15b1f0d1fdb 100644
--- a/src/objects-printer.cc
+++ b/src/objects-printer.cc
@@ -417,7 +417,7 @@ void DoPrintElements(std::ostream& os, Object* object) { // NOLINT
void PrintFixedArrayElements(std::ostream& os, FixedArray* array) {
// Print in array notation for non-sparse arrays.
- Object* previous_value = array->get(0);
+ Object* previous_value = array->length() > 0 ? array->get(0) : nullptr;
Object* value = nullptr;
int previous_index = 0;
int i;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698