1DP Maximum Sub-Array Sum

In tutorial if(dp[i]<0) dp[i]=0 this thing has been done, but what if all the elements in the array is -ve?
How would this solution manage that?

yes the code will not able thecase when the array is entirely -ve

u can share the code
i`ll make the updates and reshare it with u