fix the bug, when the diagram return null value for connection, which
will cause the system crash