Skip to content

Commit 6623b37

Browse files
Fix SpotBugs NP_ALWAYS_NULL warnings in Form and UIFragment
Fixes "Null pointer dereference" warnings reported by SpotBugs. - In `Form.java`, fix potential NPE in `getFormLayeredPane` by handling the null case for class `c` correctly and safely handling `formLayeredPane` using a local variable. - In `UIFragment.java`, initialize `el` before dereferencing it in `buildXMLFromJSONNotation` when the first element is not a String. - Update `.github/scripts/generate-quality-report.py` to fail on `NP_ALWAYS_NULL` violations.
1 parent e9df6f7 commit 6623b37

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

CodenameOne/src/com/codename1/ui/Form.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,11 +1584,7 @@ public void paintBackgrounds(Graphics g) {
15841584
cnt.setWidth(getWidth());
15851585
cnt.setHeight(getHeight());
15861586
cnt.setShouldLayout(false);
1587-
if (c != null) {
1588-
cnt.setName("FormLayer: " + c.getName());
1589-
} else {
1590-
cnt.setName("FormLayer: null");
1591-
}
1587+
cnt.setName("FormLayer: null");
15921588
flp.add(cnt);
15931589
return cnt;
15941590
}

0 commit comments

Comments
 (0)