Skip to content

Commit

Permalink
Fixed /Door throwing a null exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonty800 committed Aug 12, 2013
1 parent a0061f0 commit 240d433
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion fCraft/Commands/BuildingCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY

private static void Door( Player player, Command cmd ) {
string option = cmd.Next();
if ( option == null ) {
if ( string.IsNullOrEmpty(option) ) {
int MaxNumberOfDoorsPerPlayer = 5;
if ( DoorHandler.GetPlayerOwnedDoorsNumber( player.World, player ) >= MaxNumberOfDoorsPerPlayer ) {
player.Message( "You cannot place any more doors, a player can have a maximum of {0} doors per world",
Expand Down
8 changes: 5 additions & 3 deletions fCraft/Doors/DoorHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,11 @@ public Vector3I[] GetAffectedBlocks( Door door ) {

public static int GetPlayerOwnedDoorsNumber( World world, Player player ) {
int Number = 0;
foreach ( Door door in world.Map.Doors ) {
if ( door.Creator == player.Name ) {
Number++;
if ( world.Map.Doors != null ) {
foreach ( Door door in world.Map.Doors ) {
if ( door.Creator == player.Name ) {
Number++;
}
}
}
return Number;
Expand Down
10 changes: 5 additions & 5 deletions fCraft/Utils/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ namespace fCraft {
public static class Updater {

public static readonly ReleaseInfo CurrentRelease = new ReleaseInfo(
306,
24,
new DateTime( 2013, 05, 14, 1, 0, 0, DateTimeKind.Utc ),
307,
132,
new DateTime( 2013, 08, 14, 1, 0, 0, DateTimeKind.Utc ),
"", "",
ReleaseFlags.Bugfix
#if DEBUG
Expand All @@ -32,7 +32,7 @@ public static string UserAgent {
get { return "800Craft " + CurrentRelease.VersionString; }
}

public const string LatestStable = "0.306_r27";
public const string LatestStable = "0.307_r132";

public static string UpdateUrl { get; set; }

Expand All @@ -50,7 +50,7 @@ static Updater() {
public static bool UpdateCheck() {
try {
using ( WebClient client = new WebClient() ) {
using ( Stream stream = client.OpenRead( "http://forums.au70.net/public/update.txt" ) ) {
using ( Stream stream = client.OpenRead( "http://au70.net/public/update.txt" ) ) {
stream.ReadTimeout = 1000;
using ( StreamReader reader = new StreamReader( stream ) ) {
string s = reader.ReadLine();
Expand Down

0 comments on commit 240d433

Please sign in to comment.