TITLE: Is it true, that every morphism in a product is a retraction?
QUESTION [7 upvotes]: The definition of product in Lang's Algebra (page 58) is this: 

Let $(P,f,g)$ be a product of $A$ and $B$. Let be $C=A$ and $\varphi=id_A$. Then, by definition, there is a (unique) $h:A\to P$ morphism so, that $id_A=f\circ h$, that is, $h$ is a right inverse of $f$, that is, $f$ is a retraction. The similar holds for $g$.
Is this proof correct? I'm pretty sure that yes, but I'm a bit surprised that I didn't find this statement anywhere. That's why I need a confirmation.

REPLY [11 votes]: Almost.
It only works if some arrow $A\to B$ indeed exists. 
If we are e.g. working in the category of sets with $B=\varnothing$ and $A\neq\varnothing$ then this is not the case and also $P=A\times B=\varnothing$.
In that case $f:P=\varnothing\to A\neq\varnothing$ has no right-inverse.