go-gorp / gorp

Go Relational Persistence - an ORM-ish library for Go
MIT License
3.74k stars 371 forks source link

if table == nil ,table.TableName panic #382

Open howz97 opened 6 years ago

howz97 commented 6 years ago
func (m *DbMap) dropTable(t reflect.Type, name string, addIfExists bool) error {
    table := tableOrNil(m, t, name)
    if table == nil {
        return fmt.Errorf("table %s was not registered", table.TableName)
    }

    return m.dropTableImpl(table, addIfExists)
}
newrow commented 1 month ago

Fix:

    return fmt.Errorf("table %s was not registered", name)