driusan / dgit

A Pure Go Git Implementation
MIT License
112 stars 10 forks source link

Fix panic when trying to look into packs missing objects #258

Closed driusan closed 4 years ago

driusan commented 4 years ago

When an object doesn't exist in a packfile, checking for an object that starts with 0 can cause a panic, because the i >= 0 check is after the access in the loop condition.

Switch the order to that the loop terminates before accessing the index.