So, firstly, for h _{Theta}(x) to be 1, the weighted sum of x (after you dot product it with Theta) would have to be literally infinity, if you're using the sigmoid function. Doesn't happen in practice, even with the rounding computers do, as we don't use big numbers to initialize our Theta matrices.
Intuitively, that'd mean you're basically more certain than one can possibly be in this universe that the label of this example should be '1'.
So if (1 - h_{Theta}(x)) = 0, 'y' is certainly 1, and so 1-y will be zero.
Secondly, as the comments note, the convention is to drop the entire right-hand-side term when y^(i) is 1. This will not cause problems when programming, due to the first point I made above.