Residue Theorem for Null-Homologous Curves