In Bishop, R. L.; Goldberg, S. I., Some implications of the generalized Gauss-Bonnet theorem, Trans. Am. Math. Soc. 112, 508-535 (1964). ZBL0133.15101. on page 513 it is stated
In both Theorems 1.1 and 1.2, it is clear from the proof that $\chi(M) \neq 0$ unless $M$ is locally flat.
where
Theorem 1.1. A compact and oriented Riemannian manifold of dimension 4 whose sectional curvatures are non-negative or nonpositive has non-negative Euler-Poincaré characteristic. If the sectional curvatures are always positive or always negative, the Euler-Poincaré characteristic is positive.
Theorem 1.2. In order that a 4-dimensional compact and orientable manifold $M$ carry an Einstein metric, i.e., a Riemannian metric of constant Ricci or mean curvature $R$, it is necessary that its Euler-Poincaré characteristic be non-negative.
I do see how in Theorem 1.2 $\chi(M) = 0$ implies that $M$ is locally flat, but I don't see why it should be the same for Theorem 1.1.
The proof boils down to writing the Gauss-Bonnet integrand in dimension $4$ as presented in (4.1):
$$\frac{1}{4\pi^2} [K_{12}K_{34} + K_{13}K_{24} + K_{14}K_{23} + R_{1234}^2 + R_{1324}^2 + R_{1423}^2] \omega \tag{4.1} $$
where $\omega$ is the Riemannian volume element and $K_{ij}$ is the sectional curvature of the plane generated by $\{e_i, e_j\}$, where $\{e_1, e_2, e_3, e_4\}$ is the orthonormal basis given in Corollary 4.1 that satisfies
$$ R_{1213} = R_{1214} = R_{1223} = R_{1224} = R_{1314} = R_{1323} = 0\,. $$
If we take the sectional curvatures to be nonnegative, then all the terms in ($4.1$) are nonnegative. If we assume that $\chi(M) = 0$, then they all vanish. In order to have $M$ be locally flat, we should be able to get all the components of the Riemann tensor to be $0$. However, $\chi(M) = 0$ only gives $5$ more zero independent components (I say that because $R_{1423}^2$ depends on $R_{1234}$ and $R_{1324}$). So why should the remaining $9$ be zero as well? ($9$ because in dim $4$ the Riemann tensor has $20$ independent components, brought down to $14$ by the frame). The left components are
$R_{1334}\,, R_{1424}\,, R_{1434}\,, R_{2324}\,, R_{2334}\,, R_{2434}$
and three between
$K_{12} \text{ and } K_{34}\,, \quad K_{13} \text{ and } K_{24}\,, \quad K_{14} \text{ and } K_{23}\,.$
Am I missing something obvious?
In other books referring to these theorems, this extra information regarding Theorem 1.1 is not presented.