Given a strong earnings backdrop, investors have been optimistic that companies can weather an energy shock — so long as there is a quick resolution to the war.