Fix mw.uri error with empty fragment or query string

Off-by-one error.

Bug: 45655
Change-Id: Ic6e0dfe8dbf392b1fe9e225f7906b4dd84f4febf
Merge "Fix mw.uri error with empty fragment or query string"