Skip to content

Commit a7624bb

Browse files
committed
修复命令行模式下误调用GUI相关API报错的问题
1 parent 4732bee commit a7624bb

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/main/java/com/github/balloonupdate/mcpatch/client/Main.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static boolean AppMain(boolean graphicsMode, StartMethod startMethod, boolean en
113113
SetupSwing.init();
114114

115115
// 初始化UI
116-
window = graphicsMode ? new McPatchWindow() : null;
116+
// window = graphicsMode ? new McPatchWindow() : null;
117117

118118
// 初始化窗口
119119
if (window != null) {
@@ -181,8 +181,7 @@ static boolean AppMain(boolean graphicsMode, StartMethod startMethod, boolean en
181181

182182
// 打印异常日志
183183
try {
184-
Log.error(ex1.getClass().getName());
185-
Log.error(ex1.toString());
184+
Log.error(new McpatchBusinessException((Exception) ex1).toString());
186185
} catch (Exception e) {
187186
System.out.println("------------------------");
188187
System.out.println(e);

src/main/java/com/github/balloonupdate/mcpatch/client/Work.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public class Work {
6868
*/
6969
public boolean run() throws McpatchBusinessException {
7070
// 显示窗口
71-
if (!config.silentMode)
71+
if (window != null && !config.silentMode)
7272
window.show();
7373

7474
try(Servers server = new Servers(config)) {

0 commit comments

Comments
 (0)