 Tyrell (Dunbar, Adrian (qv)) was not scripted to hand the apple to  Richard (McKellen) in the stable, but improvised it on the spot.  McKellen took the hint and pelted the apple (supposedly at the pig).