I am working on a deck loading and shuffling program as a jumping off point to code a playable card game, but the function I am using to get the face of each card is returning a null pointer exception on the first if statement. split would put anything before ’ ’ at the zero’th position if i’m not mistaken and the code seems to be getting past the similar code for the card backs fine (that is calling to the one’th position in its array).
void getCardFace(String s, PImage p){
String[] ary = new String[2];
ary = split(s,' ');
if(ary[0]=="GenNuis"){
p = GenNuisImg;
}else if(ary[0]=="ShamGna"){
p = ShamGnaImg;
}else if(ary[0]=="BrotCly"){
p = BrotClyImg;
}else if(ary[0]=="HeavBol"){
p = HeavBolImg;
}else if(ary[0]=="MageBol"){
p = MageBolImg;
}else if(ary[0]=="SubSham"){
p = SubShamImg;
}else if(ary[0]=="OpenRad"){
p = OpenRadImg;
}else if(ary[0]=="BrokMic"){
p = BrokMicImg;
}else if(ary[0]=="ConfTra"){
p = ConfTraImg;
}else if(ary[0]=="MagAdap"){
p = MagAdapImg;
}else if(ary[0]=="Verney"){
p = VerneyImg;
}else if(ary[0]=="GalvSta"){
p = GalvStaImg;
}else if(ary[0]=="HullTit"){
p = HullTitImg;
}else if(ary[0]=="ShiHotl"){
p = ShiHotlImg;
}else if(ary[0]=="ShepMag"){
p = ShepMagImg;
}else if(ary[0]=="HomeInv"){
p = HomeInvImg;
}else if(ary[0]=="Prod"){
p = ProdImg;
}else if(ary[0]=="WizProd"){
p = WizProdImg;
}else if(ary[0]=="LucTrad"){
p = LucTradImg;
}else if(ary[0]=="ConfCra"){
p = ConfCraImg;
}else if(ary[0]=="VernEss"){
p = VernEssImg;
}else if(ary[0]=="OmnScho"){
p = OmnSchoImg;
}else if(ary[0]=="ForgHor"){
p = ForgHorImg;
}else if(ary[0]=="SpelFoc"){
p = SpelFocImg;
}else if(ary[0]=="MagGath"){
p = MagGathImg;
}else if(ary[0]=="BubCaul"){
p = BubCaulImg;
}else if(ary[0]=="QueQbie"){
p = QueQbieImg;
}else if(ary[0]=="RedBOak"){
p = RedBOakImg;
}else if(ary[0]=="OchrGou"){
p = OchrGouImg;
}else if(ary[0]=="BloBerr"){
p = BloBerrImg;
}
}