With the word “if” Peter does not suggest that his readers were failing to do good as a rule but succeeding only from time to time (and then experiencing hardship as a result). Rather, Peter recognizes that his readers were deliberate in doing good despite community distrust toward them. So with the word “if” Peter is describing the possibility that trials may befall his readers on account of their good behavior.
13 Now who is there to harm you if you are zealous for what is good?