@@ -500,8 +500,14 @@ private async Task CheckPage(IParentNode badgePage, ISet<uint> parsedAppIDs, IRe
500500 continue ;
501501 }
502502
503+ if ( statsNode == null ) {
504+ Bot . ArchiLogger . LogNullError ( statsNode ) ;
505+
506+ continue ;
507+ }
508+
503509 // Cards
504- IElement ? progressNode = statsNode ? . QuerySelector ( "span[class='progress_info_bold']" ) ;
510+ IElement ? progressNode = statsNode . QuerySelector ( "span[class='progress_info_bold']" ) ;
505511
506512 if ( progressNode == null ) {
507513 Bot . ArchiLogger . LogNullError ( progressNode ) ;
@@ -540,7 +546,7 @@ private async Task CheckPage(IParentNode badgePage, ISet<uint> parsedAppIDs, IRe
540546 }
541547
542548 // To save us on extra work, check cards earned so far first
543- IElement ? cardsEarnedNode = statsNode ? . QuerySelector ( "div[class='card_drop_info_header']" ) ;
549+ IElement ? cardsEarnedNode = statsNode . QuerySelector ( "div[class='card_drop_info_header']" ) ;
544550
545551 if ( cardsEarnedNode == null ) {
546552 Bot . ArchiLogger . LogNullError ( cardsEarnedNode ) ;
@@ -585,7 +591,7 @@ private async Task CheckPage(IParentNode badgePage, ISet<uint> parsedAppIDs, IRe
585591 }
586592
587593 // Hours
588- IElement ? timeNode = statsNode ? . QuerySelector ( "div[class='badge_title_stats_playtime']" ) ;
594+ IElement ? timeNode = statsNode . QuerySelector ( "div[class='badge_title_stats_playtime']" ) ;
589595
590596 if ( timeNode == null ) {
591597 Bot . ArchiLogger . LogNullError ( timeNode ) ;
@@ -619,15 +625,17 @@ private async Task CheckPage(IParentNode badgePage, ISet<uint> parsedAppIDs, IRe
619625 }
620626
621627 // Names
622- IElement ? nameNode = statsNode ? . QuerySelectorAll ( "div[class='card_drop_info_body']" ) . LastOrDefault ( ) ;
628+ IHtmlCollection < IElement > cardDropInfoNodes = statsNode . QuerySelectorAll ( "div[class='card_drop_info_body']" ) ;
623629
624- if ( nameNode == null ) {
625- Bot . ArchiLogger . LogNullError ( nameNode ) ;
630+ if ( cardDropInfoNodes . Count == 0 ) {
631+ Bot . ArchiLogger . LogNullError ( cardDropInfoNodes ) ;
626632
627633 continue ;
628634 }
629635
630- string name = nameNode . TextContent ;
636+ IElement lastCardDropInfoNode = cardDropInfoNodes [ ^ 1 ] ;
637+
638+ string name = lastCardDropInfoNode . TextContent ;
631639
632640 if ( string . IsNullOrEmpty ( name ) ) {
633641 Bot . ArchiLogger . LogNullError ( name ) ;
@@ -1028,16 +1036,18 @@ private async Task<bool> FarmSolo(Game game) {
10281036 return null ;
10291037 }
10301038
1031- IElement ? nameNode = htmlDocument . QuerySelectorAll ( "span[class='profile_small_header_location']" ) . LastOrDefault ( ) ;
1039+ IHtmlCollection < IElement > profileHeaderNodes = htmlDocument . QuerySelectorAll ( "span[class='profile_small_header_location']" ) ;
10321040
1033- if ( nameNode == null ) {
1041+ if ( profileHeaderNodes . Count == 0 ) {
10341042 // Normally we should log null error here, but here's why we don't: https://www.youtube.com/watch?v=nSKp2StlS6s&t=40s
1035- Bot . ArchiLogger . LogGenericWarning ( Strings . FormatErrorIsInvalid ( nameof ( nameNode ) ) ) ;
1043+ Bot . ArchiLogger . LogGenericWarning ( Strings . FormatErrorIsInvalid ( nameof ( profileHeaderNodes ) ) ) ;
10361044
10371045 return null ;
10381046 }
10391047
1040- string name = nameNode . TextContent . Trim ( ) ;
1048+ IElement lastProfileHeaderNode = profileHeaderNodes [ ^ 1 ] ;
1049+
1050+ string name = lastProfileHeaderNode . TextContent . Trim ( ) ;
10411051
10421052 if ( string . IsNullOrEmpty ( name ) ) {
10431053 Bot . ArchiLogger . LogNullError ( name ) ;
@@ -1163,10 +1173,12 @@ private async Task<bool> FarmSolo(Game game) {
11631173
11641174 byte maxPages = 1 ;
11651175
1166- IElement ? htmlNode = htmlDocument . QuerySelectorAll ( "a[class='pagelink']" ) . LastOrDefault ( ) ;
1176+ IHtmlCollection < IElement > pageLinkNodes = htmlDocument . QuerySelectorAll ( "a[class='pagelink']" ) ;
1177+
1178+ if ( pageLinkNodes . Count > 0 ) {
1179+ IElement lastPageLinkNode = pageLinkNodes [ ^ 1 ] ;
11671180
1168- if ( htmlNode != null ) {
1169- string lastPage = htmlNode . TextContent ;
1181+ string lastPage = lastPageLinkNode . TextContent ;
11701182
11711183 if ( string . IsNullOrEmpty ( lastPage ) ) {
11721184 Bot . ArchiLogger . LogNullError ( lastPage ) ;
0 commit comments