Fix system read only behavior during boot

Change-Id: I90dbdd06465e2ddaaade86b930beff91991432eb
diff --git a/twrp.cpp b/twrp.cpp
index b7fc981..e34c9b3 100644
--- a/twrp.cpp
+++ b/twrp.cpp
@@ -333,16 +333,22 @@
 #endif
 
 	// Check if system has never been changed
-	if (DataManager::GetIntValue("tw_mount_system_ro") != 0 && DataManager::GetIntValue("tw_never_show_system_ro_page") == 0) {
-		TWPartition* sys = PartitionManager.Find_Partition_By_Path("/system");
-		if (sys && sys->Check_Lifetime_Writes() == 0) {
-			LOGINFO("System writes is 0, show system_readonly page\n");
-			DataManager::SetValue("tw_back", "main");
-			if (gui_startPage("system_readonly", 1, 1) != 0) {
-				LOGERR("Failed to start system_readonly GUI page.\n");
+	TWPartition* sys = PartitionManager.Find_Partition_By_Path("/system");
+	if (sys) {
+		if (DataManager::GetIntValue("tw_mount_system_ro") != 0) {
+			if (sys->Check_Lifetime_Writes() == 0) {
+				if (DataManager::GetIntValue("tw_never_show_system_ro_page") == 0) {
+					DataManager::SetValue("tw_back", "main");
+					if (gui_startPage("system_readonly", 1, 1) != 0) {
+						LOGERR("Failed to start system_readonly GUI page.\n");
+					}
+				}
+			} else {
+				DataManager::SetValue("tw_mount_system_ro", 0);
+				sys->Change_Mount_Read_Only(false);
 			}
 		} else {
-			DataManager::SetValue("tw_mount_system_ro", 0);
+			sys->Change_Mount_Read_Only(false);
 		}
 	}