A refrigerator comprising: a refrigerator compartment; a dairy product maker provided inside the refrigerator compartment to produce a dairy product; a control panel configured to receive a control command for the dairy product maker and display a state of the dairy product maker; and a controller configured to control the dairy product maker based on the received control command, wherein the dairy product maker comprises: a container to store milk for producing the dairy product or the produced dairy product; a heater configured to heat the milk stored in the container; a fan configured to supply cool air from an inside of the refrigerator compartment to the container; and a temperature sensor configured to measure a temperature inside of the dairy product maker, and wherein the controller operates the heater for a preset fermentation period in response to receiving the control command, turns off the heater and turns on the fan to cool down the inside of the container after a lapse of the preset fermentation period, and turns off the fan in response to completing of the cooling down inside of the container, characterized in that, the controller is configured to determine whether an error occurs in the temperature sensor upon receiving the control command for the dairy product maker, configured to turn off the heater after a lapse of a preset first period from a time point at which the heater is turned on upon determining that there is an error in the temperature sensor, and configured to operate the fan for a preset second period after the heater is turned off. a refrigerator compartment; a dairy product maker provided inside the refrigerator compartment to produce a dairy product; a control panel configured to receive a control command for the dairy product maker and display a state of the dairy product maker; and a controller configured to control the dairy product maker based on the received control command, wherein the dairy product maker comprises: a container to store milk for producing the dairy product or the produced dairy product; a heater configured to heat the milk stored in the container; a fan configured to supply cool air from an inside of the refrigerator compartment to the container; and a temperature sensor configured to measure a temperature inside of the dairy product maker, and a container to store milk for producing the dairy product or the produced dairy product; a heater configured to heat the milk stored in the container; a fan configured to supply cool air from an inside of the refrigerator compartment to the container; and a temperature sensor configured to measure a temperature inside of the dairy product maker, and wherein the controller operates the heater for a preset fermentation period in response to receiving the control command, turns off the heater and turns on the fan to cool down the inside of the container after a lapse of the preset fermentation period, and turns off the fan in response to completing of the cooling down inside of the container, characterized in that, the controller is configured to determine whether an error occurs in the temperature sensor upon receiving the control command for the dairy product maker, configured to turn off the heater after a lapse of a preset first period from a time point at which the heater is turned on upon determining that there is an error in the temperature sensor, and configured to operate the fan for a preset second period after the heater is turned off.