From 0e43ba1d09c06c0f518ca0797e1331dfef532215 Mon Sep 17 00:00:00 2001 From: Lukhnos Liu Date: Mon, 19 Feb 2024 19:24:44 -0800 Subject: [PATCH] Make sure WalkResult has default values. Since ReadingGrid::walk() may return an empty WalkResult if there are no spans, it's important that no fields contain indeterminate values. After this change, a local "WalkResult x;" declaration will result in all of x's scalar fields to be 0. --- src/Engine/gramambular2/reading_grid.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Engine/gramambular2/reading_grid.h b/src/Engine/gramambular2/reading_grid.h index cd2f35a..2f1e78e 100644 --- a/src/Engine/gramambular2/reading_grid.h +++ b/src/Engine/gramambular2/reading_grid.h @@ -163,10 +163,10 @@ class ReadingGrid { struct WalkResult { std::vector nodes; - size_t totalReadings; - size_t vertices; - size_t edges; - uint64_t elapsedMicroseconds; + size_t totalReadings = 0; + size_t vertices = 0; + size_t edges = 0; + uint64_t elapsedMicroseconds = 0; // Convenient method for finding the node at the cursor. Returns // nodes.cend() if the value of cursor argument doesn't make sense. An