Merge "Fix potential NPE when connecting" into sc-dev