Skip to content

sometimes typename is none #4

@dummys

Description

@dummys

Hello,

I have a weird issue in your script that sometimes it didn't found the typename and the script crash.
As I don't have many time right now to debug I made a simple patch. Do you have a idea why it happend ?

diff '--color=auto' -ru ida-better-rtti-parser_mod/core/common.py ida-better-rtti-parser/core/common.py
--- ida-better-rtti-parser_mod/core/common.py	2022-09-22 11:29:18.943743648 +0200
+++ ida-better-rtti-parser/core/common.py	2022-09-22 11:29:57.103631866 +0200
@@ -144,10 +144,7 @@
     Ex:
     Base::SomeClass::ClassTemplate<int,double,char> --> ClassTemplate
     """
-    if name:
-        return re.sub('(<.*>|.*::)', '', name)
-    else:
-        return None
+    return re.sub('(<.*>|.*::)', '', name)
 
 
 def get_function_signature(func_ea) -> FunctionSignature:
@@ -181,9 +178,8 @@
     sig = get_function_signature(func_ea)
     
     for typename in typenames:
-        if typename:
-            ret += str(len(typename))
-            ret += typename
+        ret += str(len(typename))
+        ret += typename
 
     ret += 'E'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions