hape42 / dailygammon

DailyGammon-app is free and ad-free client for the long-running DailyGammon web-based application.
https://hape42.de/RoadMap
16 stars 6 forks source link

NSInvalidArgumentException (NULL string passed) in readPlayerArray, when clicking on opponent name that contains spaces #45

Closed kagsteiner closed 1 year ago

kagsteiner commented 1 year ago

Steps to reproduce:

  1. click on a match against an opponent with a space in her/his name (e.g. "caveat emptor" or "Cosmo Tertl")
  2. click on the name of the player in the top right corner.
  3. app crashes Happens on iPad and iPhone

Stack trace: 3 DailyGammon 0x0000000102f9cd3c -[Player readPlayerArray:] + 180 4 DailyGammon 0x0000000102f9af10 -[Player viewDidLoad] + 2116 5 UIKitCore 0x000000010b08e7ec -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 80

here's where it crashes (Player.m): -(void)readPlayerArray:(NSString*)searchLink {

NSURL *urlTopPage = [NSURL URLWithString:searchLink];
NSData *topPageHtmlData = [NSData dataWithContentsOfURL:urlTopPage];

**NSString *htmlString = [NSString stringWithUTF8String:[topPageHtmlData bytes]];**

Seems the searchLink must be quoted. It's searchLink __NSCFString * @"http://dailygammon.com/bg/plist?like=caveat emptor&type=name" 0x0000600000abf2f0 and probably should have a %20 or so where the " " between caveat emptor is?

kagsteiner commented 1 year ago

With such a user name, NSURL *urlTopPage = [NSURL URLWithString:searchLink]; in Player.m already returns nil.

kagsteiner commented 1 year ago

Trying to fix this... (trembles slightly)

kagsteiner commented 1 year ago

yes, my mighty fix seems to work!

kagsteiner commented 1 year ago

seems to work