From 6d96fb4697a57fd83878193337a757229e5c1aa1 Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Mon, 13 Dec 2021 14:04:21 -0800 Subject: [PATCH] Add more detail to a check failure seen in some Kythe indexings. Signed-off-by: Henner Zeller --- common/text/tree_utils.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/common/text/tree_utils.h b/common/text/tree_utils.h index 3dfd2732a..36cc170c3 100644 --- a/common/text/tree_utils.h +++ b/common/text/tree_utils.h @@ -204,8 +204,13 @@ const SyntaxTreeLeaf& GetSubtreeAsLeaf(const S& symbol, E parent_must_be_node_enum, size_t child_position) { internal::MustBeCSTSymbolOrNode(symbol); - return SymbolCastToLeaf(*ABSL_DIE_IF_NULL( - GetSubtreeAsSymbol(symbol, parent_must_be_node_enum, child_position))); + const Symbol* subtree = + GetSubtreeAsSymbol(symbol, parent_must_be_node_enum, child_position); + // TODO(ikr): avoid this check-failure. + CHECK(subtree != nullptr) + << symbol.Kind() << " e:" << parent_must_be_node_enum + << " p:" << child_position; + return SymbolCastToLeaf(*subtree); } template