I tried to set an integer to an already existing integer, and it gave me a NullReferenceException. So, the integer is fetched and set from a .json file, then I tried to set that to an integer called price.
Configuration.BotInfo botConfig;
int price = botConfig.TicketPriceBuy;
This is the BotInfo Class
public class BotInfo
{
public string Username { get; set; }
public string Password { get; set; }
public string DisplayName { get; set; }
public string ChatResponse { get; set; }
public string LogFile { get; set; }
public string BotControlClass { get; set; }
public int MaximumTradeTime { get; set; }
public int MaximumActionGap { get; set; }
public string DisplayNamePrefix { get; set; }
public int TradePollingInterval { get; set; }
public string LogLevel { get; set; }
public int TicketPriceBuy { get; set; }
public int BackpackExpanderPriceBuy { get; set; }
public int DecalToolPriceBuy { get; set; }
public int KeyPriceBuy { get; set; }
public int NameTagPriceBuy { get; set; }
public int AustralianGoldPriceBuy { get; set; }
public int TicketPriceSell { get; set; }
public int BackpackExpanderPriceSell { get; set; }
public int DecalToolPriceSell { get; set; }
public int KeyPriceSell { get; set; }
public int NameTagPriceSell { get; set; }
public int AustralianGoldPriceSell { get; set; }
public ulong[] Admins { get; set; }
But then I get:
Oh, there was an error: Unknown error occurred: System.NullReferenceException: Object reference not set to an instance of an object. at SteamBot.SimpleUserHandler.OnTradeAddItem(Item schemaItem, Item inventoryItem) in C:\SteamBot - JiaWei\SteamBot\UserHandler.cs:line 182 at SteamTrade.Trade.FireOnUserAddItem(TradeEvent tradeEvent) in C:\SteamBot - JiaWei\SteamTrade\Trade.cs:line 640 at SteamTrade.Trade.Poll() in C:\SteamBot - JiaWei\SteamTrade\Trade.cs:line 572 at SteamTrade.TradeManager.<>c__DisplayClass6.b__5() in C:\SteamBot - JiaWei\SteamTrade\TradeManager.cs:line 272.
Line 182 is:
int price = botConfig.TicketPriceBuy;
(The other lines don't really matter because of just following up from this first one.)
So, how would I fix this?