$\mathrm{ess\, sup}(f)=\text{sup}(f)$ for a continuous non negative function $f$ My intuition tells me that the following proposition is true:

Let $f: \Omega \rightarrow \mathbb{R}$ be a measurable function on a measurable set $\Omega \subseteq \mathbb{R}^n$. If $f$ is continuous and non negative then $\mathrm{ess\, sup}(f)=\text{sup}(f)$.

I'm using here the Borel sigma algebras on $\Omega$ and $\mathbb{R}$ respectively, and the Lebesgue measure $m$ on $\Omega$.
My measure theory background is very poor, that being said I tried to give a proof for the case where $\Omega$ is compact:
Let $A=\{a: m(\{ f\geq a \})=0 \}$. Therefore $\mathrm{ess\, sup}(f)= \inf A = E$. Let also $M=\max f = \sup f$ (it exists because $f$ is continuous on a compact set). I will prove $E \geq M$, and $E \leq M$ (otherwise there would be a contradiction on the defition of $\inf A$).


*

*$E \leq M$: if $a>M$ then $\{ f\geq a  \}=\emptyset$, so $m(\{ f\geq a  \})=0$, so $a \in A$. Therefore $E=\inf A \leq M$

*$E \geq M$: let $a \in A$, and suppose there's $x$ such that $f(x)>a$. By continuity of $f$ there also an open neighbourood $U(x)$ such that for every $y\in U(x)$ $f(y)>a$. Therefore $m(\{ f>a\})>0$ and this is impossible, since $m(\{ f\geq a  \})=0$ (because $a \in A$), $\Omega$ has finite measure since it is (closed and) bounded and  $\{ f<a  \} $ and $\{ f > a  \}$ are disjoint.


Provided the above reasoning holds I would like to extend from here the conclusion to a generic measurable $\Omega$: anybody could give me a hint in this direction? (or show me why the general proposition is wrong?)
Thanks!


Edit
Thanks to everybody for the help. Maybe it could be more  interesting to require $\Omega$ non empty and connected.

 A: For a counterexample to this proposition, take
$\Omega = [0,1] \cup \{2\}$ in $\mathbb{R}$ with $f: \Omega \to \mathbb{R}$ given by $f(x) = x$. This function is continuous.
Then $\sup f = 2$, whereas $\mathrm{ess\,sup} f = 1$, since $\{f \ge 1\} = \{1,2\}$ and $\lambda(\{1,2\}) = 0$ where $\lambda$ is Lebesgue measure.

Additional condition to make it true:
Let's additionally assume that

$\Omega \ne \varnothing$, and for all $x \in \Omega$, for any open ball $B$ around $x$, $$\lambda(B \cap \Omega) > 0. \tag{1}$$

Then, in this case your proposition is true.
For the proof, we already know $\mathrm{ess\,sup} f \le \sup f$, so we need to show $\mathrm{ess\,sup} f \ge \sup f$.
Equivalently, fix any $a < \sup f$; we want to show that $\lambda(\{f \ge a\}) > 0$. Since $a < \sup f$, there exists $x_0$ such that $f(x_0) > a$.
Since $f$ is continuous, there exists an open ball $B$ containing $x_0$ such that for $x \in B \cap \Omega$, $f(x) > a$. By our assumption (1) above, $\lambda(B \cap \Omega) > 0$. So $\lambda(\{f \ge a\}) > 0$.
Therefore, $\mathrm{ess\,sup} f = \sup f$.
A: If $m(\Omega)=0$ then $\mathrm{ess\, sup}_{\Omega} f=-\infty$ so the claim is false. 
The result does hold if we assume that $m(Q\cap \Omega)>0$ for almost every $x\in \Omega$, and each open cube $Q$ containing $x$. (Without this condition, one of the other answers shows the claim is still false.)
In general, $\sup f\ge \mathrm{ess\, sup} f$. So, suppose $b:=\sup f>\mathrm{ess\, sup}f:=a$ and without loss of generality, assume that $f$ is bounded above (if not, consider $\Omega\cap Q_n$ for compact cubes $Q_n$ of edge length $n$). 
Then, there is an $x_0\in \Omega$ and an $a'$ such that $a<a'<f(x_0)<b$ and a $\delta >0$ and a cube $Q\ni x_0$ such that $f(Q)\subseteq (a',b).$ But then, $m(\{ f\geq a' \})\ge m(Q\cap \Omega)>0,$ which is a contradiction.
