Correctly return null for invalid IDs when doing legacy conversion

This commit is contained in:
md678685 2019-08-13 15:11:43 +01:00
parent 8bcef6022b
commit 2c33fb6834

View File

@ -130,11 +130,13 @@ public interface IItemDb {
* item IDs to modern names.
*
* @param item Legacy ID in colon syntax.
* @return
* @return Material if an appropriate material exists, else null.
*/
default Material getFromLegacy(String item) {
final String[] split = item.split(":");
if (!NumberUtil.isInt(split[0])) return null;
final int id = Integer.parseInt(split[0]);
byte damage = 0;