From 54ecc8a6f8c42ba580c198b1fba38abea0a7efa0 Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Thu, 13 Jul 2023 17:50:18 -0400 Subject: Prevent null default type parser. --- docs/guide/settings.md | 1 - typeparser.cpp | 8 +++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/guide/settings.md b/docs/guide/settings.md index a2fe6226..cd3c6ea9 100644 --- a/docs/guide/settings.md +++ b/docs/guide/settings.md @@ -92,7 +92,6 @@ All settings are uniquely identified with an identifier string. Identifiers are |analysis|Tail Call Translation|Performs tail call translation for jump instructions where the target is an existing function start.|`boolean`|`True`|[`SettingsProjectScope`, `SettingsUserScope`, `SettingsResourceScope`]|analysis.tailCallTranslation| |analysis|Padding Threshold|Specify the minimum number of undefined bytes in a structure type before __padding notation is used when rendering the type to text. This setting does not affect exporting types to a file, where the __padding notation will always be used.|`number`|`1024`|[`SettingsProjectScope`, `SettingsUserScope`, `SettingsResourceScope`]|analysis.types.paddingThreshold| |analysis|Type Parser|Specify the implementation used for parsing types from text.|`string`|`ClangTypeParser`|[`SettingsProjectScope`, `SettingsUserScope`, `SettingsResourceScope`]|analysis.types.parserName| -| | | |`enum`|`CoreTypeParser`| | | | | | |`enum`|`ClangTypeParser`| | | |analysis|Type Printer|Specify the implementation used for formatting types into text.|`string`|`CoreTypePrinter`|[`SettingsProjectScope`, `SettingsUserScope`, `SettingsResourceScope`]|analysis.types.printerName| | | | |`enum`|`CoreTypePrinter`| | | diff --git a/typeparser.cpp b/typeparser.cpp index 6124004c..3a93d5fd 100644 --- a/typeparser.cpp +++ b/typeparser.cpp @@ -39,7 +39,13 @@ Ref TypeParser::GetByName(const string& name) Ref TypeParser::GetDefault() { string name = Settings::Instance()->Get("analysis.types.parserName"); - return GetByName(name); + auto parser = GetByName(name); + if (!parser) + { + // If the type parser specified doesn't exist, get the actual default type parser + parser = GetByName("ClangTypeParser"); + } + return parser; } -- cgit v1.3.1