diff --git a/libredex/Show.cpp b/libredex/Show.cpp index 0deb435955d..7ee793f8401 100644 --- a/libredex/Show.cpp +++ b/libredex/Show.cpp @@ -132,7 +132,7 @@ std::string show_type(const DexType* t, bool deobfuscated) { return std::string(""); } auto name = t->get_name()->str(); - if (!deobfuscated) { + if (!deobfuscated || name.empty()) { return str_copy(name); } if (name[0] == 'L') { diff --git a/libredex/TypeUtil.cpp b/libredex/TypeUtil.cpp index 83e603bca02..c7ca0834213 100644 --- a/libredex/TypeUtil.cpp +++ b/libredex/TypeUtil.cpp @@ -101,7 +101,10 @@ bool is_valid(std::string_view descriptor) { } bool is_primitive(const DexType* type) { - switch (type->get_name()->str().at(0)) { + auto const name = type->get_name()->str(); + always_assert_type_log(is_valid(name), INVALID_DEX, "Invalid type name: %s", + type->get_name()->c_str()); + switch (name[0]) { case 'Z': case 'B': case 'S':