Do not append ? or & at end of queries when the query to add is null or of length 0

Signed-off-by: Marc Lefrançois <mlefrancois@mirego.com>