Skip to content

Commit 4186eed

Browse files
authored
Fix NullPointerException
1 parent 8267ca5 commit 4186eed

File tree

1 file changed

+8
-8
lines changed
  • biojava-structure/src/main/java/org/biojava/nbio/structure/io

1 file changed

+8
-8
lines changed

biojava-structure/src/main/java/org/biojava/nbio/structure/io/BondMaker.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -296,15 +296,15 @@ private void formDisulfideBond(SSBondImpl disulfideBond) {
296296
// The PDB format uses author chain ids to reference chains. But one author chain id corresponds to multiple asym ids,
297297
// thus we need to grab all the possible asym ids (poly and nonpoly) and then try to find the atoms
298298
// See issue https://github.com/biojava/biojava/issues/929
299-
String polyChainId1 = structure.getPolyChainByPDB(disulfideBond.getChainID1()).getId();
300-
String polyChainId2 = structure.getPolyChainByPDB(disulfideBond.getChainID2()).getId();
299+
Chain polyChain1 = structure.getPolyChainByPDB(disulfideBond.getChainID1());
300+
Chain polyChain2 = structure.getPolyChainByPDB(disulfideBond.getChainID2());
301301
List<Chain> nonpolyChains1 = structure.getNonPolyChainsByPDB(disulfideBond.getChainID1());
302302
List<Chain> nonpolyChains2 = structure.getNonPolyChainsByPDB(disulfideBond.getChainID2());
303303

304304
List<String> allChainIds1 = new ArrayList<>();
305305
List<String> allChainIds2 = new ArrayList<>();
306-
if (polyChainId1!=null) allChainIds1.add(polyChainId1);
307-
if (polyChainId2!=null) allChainIds2.add(polyChainId2);
306+
if (polyChain1!=null) allChainIds1.add(polyChain1.getId());
307+
if (polyChain2!=null) allChainIds2.add(polyChain2.getId());
308308
if (nonpolyChains1!=null) nonpolyChains1.forEach(npc -> allChainIds1.add(npc.getId()));
309309
if (nonpolyChains2!=null) nonpolyChains2.forEach(npc -> allChainIds2.add(npc.getId()));
310310

@@ -348,17 +348,17 @@ public void formLinkRecordBond(LinkRecord linkRecord) {
348348
// The PDB format uses author chain ids to reference chains. But one author chain id corresponds to multiple asym ids,
349349
// thus we need to grab all the possible asym ids (poly and nonpoly) and then try to find the atoms
350350
// See issue https://github.com/biojava/biojava/issues/943
351-
String polyChainId1 = structure.getPolyChainByPDB(linkRecord.getChainID1()).getId();
352-
String polyChainId2 = structure.getPolyChainByPDB(linkRecord.getChainID2()).getId();
351+
Chain polyChain1 = structure.getPolyChainByPDB(linkRecord.getChainID1());
352+
Chain polyChain2 = structure.getPolyChainByPDB(linkRecord.getChainID2());
353353
List<Chain> nonpolyChains1 = structure.getNonPolyChainsByPDB(linkRecord.getChainID1());
354354
List<Chain> nonpolyChains2 = structure.getNonPolyChainsByPDB(linkRecord.getChainID2());
355355
Chain waterChain1 = structure.getWaterChainByPDB(linkRecord.getChainID1());
356356
Chain waterChain2 = structure.getWaterChainByPDB(linkRecord.getChainID2());
357357

358358
List<String> allChainIds1 = new ArrayList<>();
359359
List<String> allChainIds2 = new ArrayList<>();
360-
if (polyChainId1!=null) allChainIds1.add(polyChainId1);
361-
if (polyChainId2!=null) allChainIds2.add(polyChainId2);
360+
if (polyChain1!=null) allChainIds1.add(polyChain1.getId());
361+
if (polyChain2!=null) allChainIds2.add(polyChain2.getId());
362362
if (nonpolyChains1!=null) nonpolyChains1.forEach(npc -> allChainIds1.add(npc.getId()));
363363
if (nonpolyChains2!=null) nonpolyChains2.forEach(npc -> allChainIds2.add(npc.getId()));
364364
if (waterChain1!=null && linkRecord.getResName1().equals("HOH")) allChainIds1.add(waterChain1.getId());

0 commit comments

Comments
 (0)