community-edition icon indicating copy to clipboard operation
community-edition copied to clipboard

#setLabel breaks if the label is set to undefined

Open cdaniel opened this issue 7 years ago • 0 comments

Following code will throw an exception:

conn.getOverlay("label").setLabel(undefined);
conn.getOverlay("label").setLabel("I told you that");

The problem is that the setLabel method attempts to call a replace method on a passed parameter, and it assumes it is a type of String. The setLabel method should check the parameter for being null or at least store it internally with the code

this.label = param || "";

to ensure we do not end up with exceptions.

cdaniel avatar Jan 05 '18 07:01 cdaniel