Skip to content
This repository was archived by the owner on Apr 5, 2019. It is now read-only.
This repository was archived by the owner on Apr 5, 2019. It is now read-only.

Append method crash when passed non-string input #6

@sco1

Description

@sco1

Calling legtools.append with a non-string input is not caught by input validation.

For example:

% Sample data
x = 1:10;
y1 = x;
y2 = x + 1;

% Plot a thing!
figure
plot(x, y1, 'ro');
lh = legend('Circle', 'Location', 'NorthWest');

% Add a thing!
hold on
plot(x, y2, 'bs');
legtools.append(lh, 12)

Throws the following error:

While setting the 'DisplayName' property of 'Line':
Value must be a string.

Error in matlab.graphics.illustration.Legend/setStringImpl

Error in matlab.graphics.illustration.Legend/set.String_I

Error in matlab.graphics.illustration.Legend/set.String

Error in legtools.append (line 58)
            lh.String = newlegendstr;

Error in testcode (line 16)
    legtools.append(lh, 12)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions