Commit 8f0847af authored by George Vogiatzis's avatar George Vogiatzis Committed by Nate Graham

[Applet]Add port check

Summary:
Add port check before port.description check.

Cannot check port.description if port does not exist.

Test Plan:
Before:
If there is a device with ports, and an other one without ports, will fail to display the name a device, or crash?

After:
Name should be displayed correctly in every case.

Reviewers: #plasma, drosca, ngraham

Reviewed By: ngraham

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D27074
parent e6a3111f
......@@ -39,7 +39,7 @@ ListItemBase {
if (i !== index) {
var port = model.data(model.index(i, 0), model.role("Ports"))
[model.data(model.index(i, 0), model.role("ActivePortIndex"))];
if (port.description) {
if (port && port.description) {
var length = Math.min(itemLength, port.description.length)
if (currentPort.description.substring(0, length) === port.description.substring(0, length)) {
return i18nc("label of device items", "%1 (%2)", currentPort.description, Description);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment