if PendingCommands.SiteFetchSiteNumber is null (and thus sNum is null), then this would cause a null reference exception when you call sNum.Trim()
Also if you show the full stack trace it should give you the exact line number that the error occurred on, which is a lot simpler to debug than using an incremental value to figure it out.