Skip to content

Commit

Permalink
Fixed nil panic
Browse files Browse the repository at this point in the history
  • Loading branch information
zachmu committed Sep 12, 2024
1 parent f47dfea commit 968726d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions go/libraries/doltcore/sqle/dprocedures/dolt_reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,20 @@ func doDoltReset(ctx *sql.Context, args []string) (int, error) {
return 1, err
}
} else {
firstArg := apr.Arg(0)
if apr.NArg() != 1 || (apr.NArg() == 1 && firstArg == ".") {
if apr.NArg() != 1 || (apr.NArg() == 1 && apr.Arg(0) == ".") {
err := resetSoftTables(ctx, apr, roots, dSess, dbName)
if err != nil {
return 1, err
}
} else {
// check if the input is a table name or commit ref
if isTableInRoots(ctx, roots, firstArg) {
if isTableInRoots(ctx, roots, apr.Arg(0)) {
err := resetSoftTables(ctx, apr, roots, dSess, dbName)
if err != nil {
return 1, err
}
} else {
err := resetSoftToRef(ctx, dbData, firstArg, dSess, dbName)
err := resetSoftToRef(ctx, dbData, apr.Arg(0), dSess, dbName)
if err != nil {
return 1, err
}
Expand Down

0 comments on commit 968726d

Please sign in to comment.