Skip to content

Commit

Permalink
Bug 561857: fix NPE if extKey is null
Browse files Browse the repository at this point in the history
266971

Change-Id: I74784c2fa07f1ce926740bb93253751f37e98426
Signed-off-by: Daniel Schmid <Daniel.Schmid@bsiag.com>
Reviewed-on: https://git.eclipse.org/r/c/scout/org.eclipse.scout.rt/+/174414
Tested-by: Scout Bot <scout-bot@eclipse.org>
Tested-by: Ivan Motsch <ivan.motsch@bsiag.com>
Reviewed-by: Ivan Motsch <ivan.motsch@bsiag.com>
  • Loading branch information
d-schmid authored and imotsch committed Jan 8, 2021
1 parent 1af955a commit afec739
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -424,22 +424,19 @@ public ICode<T> getChildCode(T id) {

@Override
public ICode<T> getChildCodeByExtKey(Object extKey) {
if (m_codeList == null) {
if (m_codeList == null || extKey == null) {
return null;
}
ICode<T> c = null;
for (ICode<T> childCode : m_codeList) {
if (extKey.equals(childCode.getExtKey())) {
return childCode;
}
else {
c = childCode.getChildCodeByExtKey(extKey);
if (c != null) {
return c;
}
ICode<T> c = childCode.getChildCodeByExtKey(extKey);
if (c != null) {
return c;
}
}
return c;
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,19 +385,16 @@ public CODE getCodeByExtKey(Object extKey) {
if (extKey == null) {
return null;
}
CODE c = null;
for (CODE childCode : m_rootCodeList) {
if (extKey.equals(childCode.getExtKey())) {
c = childCode;
}
else {
c = (CODE) childCode.getChildCodeByExtKey(extKey);
return childCode;
}
CODE c = (CODE) childCode.getChildCodeByExtKey(extKey);
if (c != null) {
return c;
}
}
return c;
return null;
}

@Override
Expand Down

0 comments on commit afec739

Please sign in to comment.