[sgen] Fix pointer access.

Thanks to martinpotter for finding the bug.