Add check for invalid house ID
This commit is contained in:
@@ -774,6 +774,10 @@ function createHouse(description, entrancePosition, exitPosition, entrancePickup
|
||||
// ===========================================================================
|
||||
|
||||
function getHouseDataFromDatabaseId(databaseId) {
|
||||
if (databaseId <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let matchingHouses = getServerData().houses.filter(b => b.databaseId == databaseId)
|
||||
if (matchingHouses.length == 1) {
|
||||
return matchingHouses[0];
|
||||
@@ -1431,6 +1435,10 @@ function buyHouseCommand(command, params, client) {
|
||||
* @return {HouseData} The house's data (class instance)
|
||||
*/
|
||||
function getHouseData(houseId) {
|
||||
if (houseId == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof getServerData().houses[houseId] != "undefined") {
|
||||
return getServerData().houses[houseId];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user