Length check for armor set getters.

This commit is contained in:
MobiusDevelopment
2020-08-03 14:09:21 +00:00
parent 4d9f34b5ba
commit 917c02c7da
19 changed files with 99 additions and 23 deletions

View File

@@ -175,9 +175,13 @@ public class ArmorSetData implements IXmlReader
* @return the armor set associated to the given item id * @return the armor set associated to the given item id
*/ */
public ArmorSet getSet(int setId) public ArmorSet getSet(int setId)
{
if (_armorSets.length >= setId)
{ {
return _armorSets[setId]; return _armorSets[setId];
} }
return null;
}
/** /**
* @param itemId the item id that is attached to a set * @param itemId the item id that is attached to a set

View File

@@ -175,9 +175,13 @@ public class ArmorSetData implements IXmlReader
* @return the armor set associated to the given item id * @return the armor set associated to the given item id
*/ */
public ArmorSet getSet(int setId) public ArmorSet getSet(int setId)
{
if (_armorSets.length >= setId)
{ {
return _armorSets[setId]; return _armorSets[setId];
} }
return null;
}
/** /**
* @param itemId the item id that is attached to a set * @param itemId the item id that is attached to a set

View File

@@ -175,9 +175,13 @@ public class ArmorSetData implements IXmlReader
* @return the armor set associated to the given item id * @return the armor set associated to the given item id
*/ */
public ArmorSet getSet(int setId) public ArmorSet getSet(int setId)
{
if (_armorSets.length >= setId)
{ {
return _armorSets[setId]; return _armorSets[setId];
} }
return null;
}
/** /**
* @param itemId the item id that is attached to a set * @param itemId the item id that is attached to a set

View File

@@ -175,9 +175,13 @@ public class ArmorSetData implements IXmlReader
* @return the armor set associated to the given item id * @return the armor set associated to the given item id
*/ */
public ArmorSet getSet(int setId) public ArmorSet getSet(int setId)
{
if (_armorSets.length >= setId)
{ {
return _armorSets[setId]; return _armorSets[setId];
} }
return null;
}
/** /**
* @param itemId the item id that is attached to a set * @param itemId the item id that is attached to a set

View File

@@ -175,9 +175,13 @@ public class ArmorSetData implements IXmlReader
* @return the armor set associated to the given item id * @return the armor set associated to the given item id
*/ */
public ArmorSet getSet(int setId) public ArmorSet getSet(int setId)
{
if (_armorSets.length >= setId)
{ {
return _armorSets[setId]; return _armorSets[setId];
} }
return null;
}
/** /**
* @param itemId the item id that is attached to a set * @param itemId the item id that is attached to a set

View File

@@ -177,9 +177,13 @@ public class ArmorSetData implements IXmlReader
* @return the armor set associated to the given item id * @return the armor set associated to the given item id
*/ */
public ArmorSet getSet(int setId) public ArmorSet getSet(int setId)
{
if (_armorSets.length >= setId)
{ {
return _armorSets[setId]; return _armorSets[setId];
} }
return null;
}
/** /**
* @param itemId the item id that is attached to a set * @param itemId the item id that is attached to a set

View File

@@ -177,9 +177,13 @@ public class ArmorSetData implements IXmlReader
* @return the armor set associated to the given item id * @return the armor set associated to the given item id
*/ */
public ArmorSet getSet(int setId) public ArmorSet getSet(int setId)
{
if (_armorSets.length >= setId)
{ {
return _armorSets[setId]; return _armorSets[setId];
} }
return null;
}
/** /**
* @param itemId the item id that is attached to a set * @param itemId the item id that is attached to a set

View File

@@ -177,9 +177,13 @@ public class ArmorSetData implements IXmlReader
* @return the armor set associated to the given item id * @return the armor set associated to the given item id
*/ */
public ArmorSet getSet(int setId) public ArmorSet getSet(int setId)
{
if (_armorSets.length >= setId)
{ {
return _armorSets[setId]; return _armorSets[setId];
} }
return null;
}
/** /**
* @param itemId the item id that is attached to a set * @param itemId the item id that is attached to a set

View File

@@ -93,13 +93,17 @@ public class ArmorSetData implements IXmlReader
public boolean setExists(int chestId) public boolean setExists(int chestId)
{ {
return _armorSets[chestId] != null; return (_armorSets.length >= chestId) && (_armorSets[chestId] != null);
} }
public ArmorSet getSet(int chestId) public ArmorSet getSet(int chestId)
{
if (_armorSets.length >= chestId)
{ {
return _armorSets[chestId]; return _armorSets[chestId];
} }
return null;
}
public static ArmorSetData getInstance() public static ArmorSetData getInstance()
{ {

View File

@@ -93,13 +93,17 @@ public class ArmorSetData implements IXmlReader
public boolean setExists(int chestId) public boolean setExists(int chestId)
{ {
return _armorSets[chestId] != null; return (_armorSets.length >= chestId) && (_armorSets[chestId] != null);
} }
public ArmorSet getSet(int chestId) public ArmorSet getSet(int chestId)
{
if (_armorSets.length >= chestId)
{ {
return _armorSets[chestId]; return _armorSets[chestId];
} }
return null;
}
public static ArmorSetData getInstance() public static ArmorSetData getInstance()
{ {

View File

@@ -176,7 +176,7 @@ public class ArmorSetData implements IXmlReader
*/ */
public boolean isArmorSet(int chestId) public boolean isArmorSet(int chestId)
{ {
return _armorSets[chestId] != null; return (_armorSets.length >= chestId) && (_armorSets[chestId] != null);
} }
/** /**
@@ -185,9 +185,13 @@ public class ArmorSetData implements IXmlReader
* @return the armor set associated to the give chest Id. * @return the armor set associated to the give chest Id.
*/ */
public ArmorSet getSet(int chestId) public ArmorSet getSet(int chestId)
{
if (_armorSets.length >= chestId)
{ {
return _armorSets[chestId]; return _armorSets[chestId];
} }
return null;
}
/** /**
* Gets the single instance of ArmorSetsData. * Gets the single instance of ArmorSetsData.

View File

@@ -176,7 +176,7 @@ public class ArmorSetData implements IXmlReader
*/ */
public boolean isArmorSet(int chestId) public boolean isArmorSet(int chestId)
{ {
return _armorSets[chestId] != null; return (_armorSets.length >= chestId) && (_armorSets[chestId] != null);
} }
/** /**
@@ -185,9 +185,13 @@ public class ArmorSetData implements IXmlReader
* @return the armor set associated to the give chest Id. * @return the armor set associated to the give chest Id.
*/ */
public ArmorSet getSet(int chestId) public ArmorSet getSet(int chestId)
{
if (_armorSets.length >= chestId)
{ {
return _armorSets[chestId]; return _armorSets[chestId];
} }
return null;
}
/** /**
* Gets the single instance of ArmorSetsData. * Gets the single instance of ArmorSetsData.

View File

@@ -175,9 +175,13 @@ public class ArmorSetData implements IXmlReader
* @return the armor set associated to the given item id * @return the armor set associated to the given item id
*/ */
public ArmorSet getSet(int setId) public ArmorSet getSet(int setId)
{
if (_armorSets.length >= setId)
{ {
return _armorSets[setId]; return _armorSets[setId];
} }
return null;
}
/** /**
* @param itemId the item id that is attached to a set * @param itemId the item id that is attached to a set

View File

@@ -175,9 +175,13 @@ public class ArmorSetData implements IXmlReader
* @return the armor set associated to the given item id * @return the armor set associated to the given item id
*/ */
public ArmorSet getSet(int setId) public ArmorSet getSet(int setId)
{
if (_armorSets.length >= setId)
{ {
return _armorSets[setId]; return _armorSets[setId];
} }
return null;
}
/** /**
* @param itemId the item id that is attached to a set * @param itemId the item id that is attached to a set

View File

@@ -175,9 +175,13 @@ public class ArmorSetData implements IXmlReader
* @return the armor set associated to the given item id * @return the armor set associated to the given item id
*/ */
public ArmorSet getSet(int setId) public ArmorSet getSet(int setId)
{
if (_armorSets.length >= setId)
{ {
return _armorSets[setId]; return _armorSets[setId];
} }
return null;
}
/** /**
* @param itemId the item id that is attached to a set * @param itemId the item id that is attached to a set

View File

@@ -177,9 +177,13 @@ public class ArmorSetData implements IXmlReader
* @return the armor set associated to the given item id * @return the armor set associated to the given item id
*/ */
public ArmorSet getSet(int setId) public ArmorSet getSet(int setId)
{
if (_armorSets.length >= setId)
{ {
return _armorSets[setId]; return _armorSets[setId];
} }
return null;
}
/** /**
* @param itemId the item id that is attached to a set * @param itemId the item id that is attached to a set

View File

@@ -177,9 +177,13 @@ public class ArmorSetData implements IXmlReader
* @return the armor set associated to the given item id * @return the armor set associated to the given item id
*/ */
public ArmorSet getSet(int setId) public ArmorSet getSet(int setId)
{
if (_armorSets.length >= setId)
{ {
return _armorSets[setId]; return _armorSets[setId];
} }
return null;
}
/** /**
* @param itemId the item id that is attached to a set * @param itemId the item id that is attached to a set

View File

@@ -177,9 +177,13 @@ public class ArmorSetData implements IXmlReader
* @return the armor set associated to the given item id * @return the armor set associated to the given item id
*/ */
public ArmorSet getSet(int setId) public ArmorSet getSet(int setId)
{
if (_armorSets.length >= setId)
{ {
return _armorSets[setId]; return _armorSets[setId];
} }
return null;
}
/** /**
* @param itemId the item id that is attached to a set * @param itemId the item id that is attached to a set

View File

@@ -175,9 +175,13 @@ public class ArmorSetData implements IXmlReader
* @return the armor set associated to the given item id * @return the armor set associated to the given item id
*/ */
public ArmorSet getSet(int setId) public ArmorSet getSet(int setId)
{
if (_armorSets.length >= setId)
{ {
return _armorSets[setId]; return _armorSets[setId];
} }
return null;
}
/** /**
* @param itemId the item id that is attached to a set * @param itemId the item id that is attached to a set