In addNdnHubChangedListener, if the current host and port are not null, call listener with the values to initialize.
diff --git a/js/ndnProtocol/modules/NdnProtocolInfo.jsm b/js/ndnProtocol/modules/NdnProtocolInfo.jsm
index 553e1ba..a2fb10d 100644
--- a/js/ndnProtocol/modules/NdnProtocolInfo.jsm
+++ b/js/ndnProtocol/modules/NdnProtocolInfo.jsm
@@ -17,9 +17,19 @@
/*
* When the NDN hub host or port is changed, the system calls listener(host, port).
+ * If the current host and port are not null, call listener with the values to initialize.
*/
function addNdnHubChangedListener(listener) {
ndnHubChangedListenerList.push(listener);
+
+ if (ndnHubHost != null && ndnHubPort != null) {
+ try {
+ listener(ndnHubHost, ndnHubPort);
+ }
+ catch (ex) {
+ // Ignore error from the listener.
+ }
+ }
}
/*