Skip to content

Commit

Permalink
Fix segfault in learner. (#256)
Browse files Browse the repository at this point in the history
When learner is initialized at program startup we want to initialize an
empty array because learned examples might arrive during program
execution.

If we have a nil matrix to store them we will get a segfault.

Ensuring a matrix is always initialized at startup is one way to solve
this.

Follow up to #252
  • Loading branch information
jlewi authored Sep 26, 2024
1 parent 95ffab7 commit dbbfaf8
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions app/pkg/learn/in_memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,6 @@ func (db *InMemoryExampleDB) loadExamples(ctx context.Context) error {
return errors.Wrapf(err, "Failed to match glob %s", glob)
}

// TODO(jeremy): How should we handle there being no examples?
if len(matches) == 0 {
continue
}

if db.examples == nil {
db.examples = make([]*v1alpha1.Example, 0, len(matches))
}
Expand Down

0 comments on commit dbbfaf8

Please sign in to comment.