spellshift/realm

[bug] Get Registry Tome Errors when an Entry is Empty

Closed this issue · 0 comments

Describe the bug
When running the Get Registry tome and providing an empty registry entry the eldritch will error like so:
Screenshot 2024-02-29 at 4 51 41 PM

The issue appears to be that we do not check the length of the results keys before doing a list comprehension:

def pad_key(key, max_len):
    res = key+" "*(max_len-len(key))
    return res

def get_registry(hive, path):
    res = sys.get_reg(hive, path)
    max_len = max([ len(i) for i in res.keys()]) # <------ we should check `res` before this
    for k in res:
        v = res[k]
        pk = pad_key(k,max_len)
        print(f"{pk} : {v}")

get_registry(input_params['hive'], input_params['path'])
print()

To Reproduce
Steps to reproduce the behavior:

  1. Run the Tome providing an empty entry
  2. Observe the output above

Expected behavior
It should probably either return a nicer to read error or just an empty response