@@ -181,10 +181,10 @@ static void write_cached_object(struct object *obj)
181181static int check_object (struct object * obj , int type , void * data )
182182{
183183 if (!obj )
184- return 0 ;
184+ return 1 ;
185185
186186 if (obj -> flags & FLAG_WRITTEN )
187- return 1 ;
187+ return 0 ;
188188
189189 if (type != OBJ_ANY && obj -> type != type )
190190 die ("object type mismatch" );
@@ -195,22 +195,24 @@ static int check_object(struct object *obj, int type, void *data)
195195 if (type != obj -> type || type <= 0 )
196196 die ("object of unexpected type" );
197197 obj -> flags |= FLAG_WRITTEN ;
198- return 1 ;
198+ return 0 ;
199199 }
200200
201201 if (fsck_object (obj , 1 , fsck_error_function ))
202202 die ("Error in object" );
203- if (! fsck_walk (obj , check_object , NULL ))
203+ if (fsck_walk (obj , check_object , NULL ))
204204 die ("Error on reachable objects of %s" , sha1_to_hex (obj -> sha1 ));
205205 write_cached_object (obj );
206- return 1 ;
206+ return 0 ;
207207}
208208
209209static void write_rest (void )
210210{
211211 unsigned i ;
212- for (i = 0 ; i < nr_objects ; i ++ )
213- check_object (obj_list [i ].obj , OBJ_ANY , NULL );
212+ for (i = 0 ; i < nr_objects ; i ++ ) {
213+ if (obj_list [i ].obj )
214+ check_object (obj_list [i ].obj , OBJ_ANY , NULL );
215+ }
214216}
215217
216218static void added_object (unsigned nr , enum object_type type ,
0 commit comments