Skip to content

Commit c33838d

Browse files
committed
fix: general issues and minor bugs
1 parent 553391c commit c33838d

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

src/WebExpress.WebIndex/Storage/IndexStorageDocumentStore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public void Delete(TIndexItem item)
190190
var segment = list.SkipWhile(x => x.Id != item.Id).FirstOrDefault();
191191

192192
HashMap.Remove(segment);
193-
foreach (var chunk in segment.ChunkSegments)
193+
foreach (var chunk in segment?.ChunkSegments ?? [])
194194
{
195195
Allocator.Free(chunk);
196196
}

src/WebExpress.WebIndex/Storage/IndexStorageSegmentHashMap.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,11 @@ public IEnumerable<IndexStorageSegmentItem> GetBucket(Guid id)
204204
/// found in the list.</returns>
205205
public bool Remove(IndexStorageSegmentItem segment)
206206
{
207+
if (segment == null)
208+
{
209+
return false;
210+
}
211+
207212
var hash = segment.Id.GetHashCode();
208213
var index = (uint)hash % BucketCount;
209214
var bucket = GetBucket(index);

0 commit comments

Comments
 (0)