Skip to content

Commit 733d9d6

Browse files
committed
Fixed crash when pushing a new branch due to bug in LFS
1 parent e4c221b commit 733d9d6

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/main/kotlin/com/jetpackduba/gitnuro/lfs/AppLfsFactory.kt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,17 +189,20 @@ class LfsPrePushHook @AssistedInject constructor(
189189
}
190190

191191
private fun findLfsPointers(toPush: MutableSet<LfsPointer>, walk: ObjectWalk) {
192-
var obj: RevObject
192+
var obj: RevObject?
193193
val r = walk.objectReader
194-
while ((walk.nextObject().also { obj = it }) != null) {
195-
if (obj.type == Constants.OBJ_BLOB
196-
&& getObjectSize(r, obj) < LfsPointer.SIZE_THRESHOLD
197-
) {
194+
195+
obj = walk.nextObject()
196+
197+
while (obj != null) {
198+
if (obj.type == Constants.OBJ_BLOB && getObjectSize(r, obj) < LfsPointer.SIZE_THRESHOLD) {
198199
val ptr = loadLfsPointer(r, obj)
199200
if (ptr != null) {
200201
toPush.add(ptr)
201202
}
202203
}
204+
205+
obj = walk.nextObject()
203206
}
204207
}
205208

0 commit comments

Comments
 (0)