Skip to content

get_object return value is not checked #16

Description

@kmsquire

We're occasionally getting an error,

  File "/usr/local/lib/python3.9/site-packages/gitinfo/gitinfo.py", line 108, in get_git_info
    return get_git_info_dir(gitdir)
  File "/usr/local/lib/python3.9/site-packages/gitinfo/gitinfo.py", line 86, in get_git_info_dir
    r = get_pack_info(idx_file, gi)
  File "/usr/local/lib/python3.9/site-packages/gitinfo/pack_reader.py", line 176, in get_pack_info
    data = get_object(fin, pack_idx)
  File "/usr/local/lib/python3.9/site-packages/gitinfo/pack_reader.py", line 149, in get_object
    data, r = decode_delta(fin, data, delta_res, pack_idx, offset)
  File "/usr/local/lib/python3.9/site-packages/gitinfo/pack_reader.py", line 110, in decode_delta
    r += oo[offset : offset + size]
  TypeError: 'NoneType' object is not subscriptable

This seems to be caused by get_object returning None to decode_delta (in these lines). Unfortunately, this seems to only happen in CI and is not locally reproducible, so I don't have any specific information about the contents of the git repo.

That said, because get_info can return None, calls to it should probably be checked for None and handled appropriately.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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