Fix NPE in SQL initialization

Happens when the database could not be opened. Introduced by e849da9
This commit is contained in:
Quentin Machu 2015-12-06 19:48:49 -05:00
parent 0a6e5fad1a
commit 582c4e1ca4

View file

@ -64,10 +64,10 @@ func connectSQLTables(addr string, _ graph.Options) (*sql.DB, error) {
func createSQLTables(addr string, options graph.Options) error {
conn, err := connectSQLTables(addr, options)
defer conn.Close()
if err != nil {
return err
}
defer conn.Close()
tx, err := conn.Begin()
if err != nil {
glog.Errorf("Couldn't begin creation transaction: %s", err)