@@ -75,27 +75,52 @@ public override unsafe void Draw()
75
75
76
76
var color = * ImGui . GetStyleColorVec4 ( ImGuiCol . TextDisabled ) ;
77
77
78
- var isAoe = Service . Config . UseAoeAction
79
- && ( ! DataCenter . IsManual
80
- || Service . Config . UseAoeWhenManual ) ;
78
+ var isAoe = Service . Config . UseAoeAction && ( ! DataCenter . IsManual || Service . Config . UseAoeWhenManual ) ;
79
+
80
+ // Track whether the style color was pushed
81
+ bool pushedStyleColor = false ;
82
+
83
+ if ( ! isAoe )
84
+ {
85
+ ImGui . PushStyleColor ( ImGuiCol . Text , color ) ;
86
+ pushedStyleColor = true ; // Indicate that a style color has been pushed
87
+ }
81
88
82
- if ( ! isAoe ) ImGui . PushStyleColor ( ImGuiCol . Text , color ) ;
83
89
if ( ImGuiHelper . SelectableButton ( "AOE" ) )
84
90
{
85
91
Service . Config . UseAoeAction . Value = ! isAoe ;
86
92
Service . Config . UseAoeWhenManual . Value = ! isAoe ;
87
93
}
88
- if ( ! isAoe ) ImGui . PopStyleColor ( ) ;
94
+
95
+ // Ensure PopStyleColor is called only if PushStyleColor was called
96
+ if ( pushedStyleColor )
97
+ {
98
+ ImGui . PopStyleColor ( ) ;
99
+ }
100
+
89
101
90
102
ImGui . SameLine ( ) ;
91
103
92
104
var isBurst = Service . Config . AutoBurst ;
93
- if ( ! isBurst ) ImGui . PushStyleColor ( ImGuiCol . Text , color ) ;
105
+ // Track whether the style color was pushed
106
+ pushedStyleColor = false ;
107
+
108
+ if ( ! isBurst )
109
+ {
110
+ ImGui . PushStyleColor ( ImGuiCol . Text , color ) ;
111
+ pushedStyleColor = true ; // Indicate that a style color has been pushed
112
+ }
113
+
94
114
if ( ImGuiHelper . SelectableButton ( "Burst" ) )
95
115
{
96
116
Service . Config . AutoBurst . Value = ! isBurst ;
97
117
}
98
- if ( ! isBurst ) ImGui . PopStyleColor ( ) ;
118
+
119
+ // Ensure PopStyleColor is called only if PushStyleColor was called
120
+ if ( pushedStyleColor )
121
+ {
122
+ ImGui . PopStyleColor ( ) ;
123
+ }
99
124
ImGui . SameLine ( ) ;
100
125
columnWidth = Math . Max ( columnWidth , ImGui . GetCursorPosX ( ) ) ;
101
126
ImGui . NewLine ( ) ;
0 commit comments