Fix segfault if gitmodules is invalid

The reload_all call could end up dereferencing a NULL pointer if
there was an error while attempting to load the submodules config
data (i.e. invalid content in the gitmodules file).  This fixes it.
Fix error when submodule path and name differ

When a submodule was inserted with a different path and name, the
return value from khash greater than zero was allowed to propagate
back out to the caller when it should really be zeroed.  This led
to a possible crash when reloading submodules if that was the
first time that submodule data was loaded.
Merge pull request #2210 from libgit2/rb/submodule-api-with-no-submodules

Fix segfault if gitmodules is invalid