Nothing Special   »   [go: up one dir, main page]

Skip to content

Commit

Permalink
Fix #676
Browse files Browse the repository at this point in the history
  • Loading branch information
hhrutter committed Aug 21, 2023
1 parent 91b6234 commit b42e6eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pkg/pdfcpu/model/nameTree.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,12 @@ func (n *Node) HandleLeaf(xRefTable *XRefTable, k string, v types.Object, m Name
if err == nil {
break
}
if len(m) == 0 {
return err
}
if err != errNameTreeDuplicateKey {
return err
}
if len(m) == 0 {
return nil
}
kNew := k + "\x01"
dd, ok := m[kOrig]
if !ok {
Expand Down
4 changes: 2 additions & 2 deletions pkg/pdfcpu/model/nameTree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ func destroyNameTree(t *testing.T, r *Node) {
t.Fatal("should not find Value for x")
}

if err := r.Add(nil, "c", types.StringLiteral("cvv"), nil, nil); err == nil {
t.Fatalf("update c:should trigger DuplicateKeyException")
if err := r.Add(nil, "c", types.StringLiteral("cvv"), nil, nil); err != nil {
t.Fatalf("update c:should not trigger DuplicateKeyException")
}

empty, ok, _ = r.Remove(nil, "c")
Expand Down

0 comments on commit b42e6eb

Please sign in to comment.