Don't crash on new nodes (fixes #656)

This commit is contained in:
Jakob Borg 2014-09-10 08:30:35 +02:00
parent 5537d53f9a
commit 1e51fca0b0

View File

@ -565,10 +565,10 @@ func (cf cFiler) CurrentFile(file string) protocol.FileInfo {
// ConnectedTo returns true if we are connected to the named node. // ConnectedTo returns true if we are connected to the named node.
func (m *Model) ConnectedTo(nodeID protocol.NodeID) bool { func (m *Model) ConnectedTo(nodeID protocol.NodeID) bool {
m.pmut.RLock() m.pmut.RLock()
_, ok := m.protoConn[nodeID] if statRef, ok := m.nodeStatRefs[nodeID]; ok {
if ok { statRef.WasSeen()
m.nodeStatRefs[nodeID].WasSeen()
} }
_, ok := m.protoConn[nodeID]
m.pmut.RUnlock() m.pmut.RUnlock()
return ok return ok
} }