Skip to content

Commit 67412fc

Browse files
dialect/sql/sqlgraph: tried to fix npe in graph
1 parent 2bf20f6 commit 67412fc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

dialect/sql/sqlgraph/graph.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1312,7 +1312,11 @@ func (u *updater) node(ctx context.Context, tx dialect.ExecQuerier) error {
13121312
if u.builder.Dialect() == dialect.YDB {
13131313
affected, err = u.selectWithUpdate(ctx, idPredicate, addEdges, clearEdges)
13141314
} else {
1315-
affected, err = execUpdate(ctx, tx, update, u.Node.ID.Column)
1315+
column := ""
1316+
if u.Node.ID != nil {
1317+
column = u.Node.ID.Column
1318+
}
1319+
affected, err = execUpdate(ctx, tx, update, column)
13161320
}
13171321
if err != nil {
13181322
return err

0 commit comments

Comments
 (0)