The artificial pancreas aims at the automatic delivery of insulin for glycemic control in patients with type 1 diabetes, i.e., closed-loop glucose control. One of the challenges of the artificial pancreas is to avoid controller overreaction leading to hypoglycemia, especially in the late postprandial period. In this study, an original proposal based on sliding mode reference conditioning ideas is presented as a way to reduce hypoglycemia events induced by a closed-loop glucose controller. The method is inspired in the intuitive advantages of two-step constrained control algorithms. It acts on the glucose reference sent to the main controller shaping it so as to avoid violating given constraints on the insulin-on-board. Some distinctive features of the proposed strategy are that 1) it provides a safety layer which can be adjusted according to medical criteria; 2) it can be added to closed-loop controllers of any nature; 3) it is robust against sensor failures and overestimated prandial insulin doses; and 4) it can handle nonlinear models. The method is evaluated in silico with the ten adult patients available in the FDA-accepted UVA simulator.