The invention belongs to the technical field of charging, and provides an electronic device and a power adapter of the electronic device. The power adapter comprising a power source module, a master control module, an electric level adjustment module, a current detection module, a voltage detection module and an output switch module is provided for the electronic device, the master control module judges whether the output current of the power adapter is larger than a current threshold and whether the output voltage of the power adapter is larger than a voltage threshold, and if the output current is larger than the current threshold and / or the output voltage is larger than the voltage threshold, the master control module controls the output switch module to close direct current electricity output of the power adapter. In addition, if the electronic device judges that the output of the power adapter has an overcurrent and / or overvoltage phenomenon and feeds a charging closing instruction back to the master control module, the master control module controls the output switch module to close the direct current electricity output of the power adapter according to the charging closing instruction, and therefore the purpose of achieving overcurrent and / or overvoltage protection is achieved for a battery.