From 68ee419d83e7a9cb80aa63dd5dbea6d391ee7d32 Mon Sep 17 00:00:00 2001 From: "kepler155c@gmail.com" Date: Fri, 9 Nov 2018 15:07:55 -0500 Subject: [PATCH] fix invalid msg crashing socket --- sys/apis/config.lua | 4 +++- sys/apis/socket.lua | 2 +- sys/apps/PackageManager.lua | 3 +-- sys/apps/{Package.lua => package.lua} | 0 4 files changed, 5 insertions(+), 4 deletions(-) rename sys/apps/{Package.lua => package.lua} (100%) diff --git a/sys/apis/config.lua b/sys/apis/config.lua index 20f4e86..13ab441 100644 --- a/sys/apis/config.lua +++ b/sys/apis/config.lua @@ -20,6 +20,8 @@ function Config.load(fname, data) Util.merge(data, contents) end + + return data end function Config.loadWithCheck(fname, data) @@ -36,7 +38,7 @@ function Config.loadWithCheck(fname, data) shell.run('edit ' .. filename) end - Config.load(fname, data) + return Config.load(fname, data) end function Config.update(fname, data) diff --git a/sys/apis/socket.lua b/sys/apis/socket.lua index df47a79..6cfca6a 100644 --- a/sys/apis/socket.lua +++ b/sys/apis/socket.lua @@ -183,7 +183,7 @@ function Socket.server(port) local _, _, sport, dport, msg = os.pullEvent('modem_message') if sport == port and - msg and + msg and type(msg) == 'table' and msg.dhost == os.getComputerID() and msg.type == 'OPEN' then diff --git a/sys/apps/PackageManager.lua b/sys/apps/PackageManager.lua index 717c167..fd05cf0 100644 --- a/sys/apps/PackageManager.lua +++ b/sys/apps/PackageManager.lua @@ -3,7 +3,6 @@ _G.requireInjector(_ENV) local Ansi = require('ansi') local Packages = require('packages') local UI = require('ui') -local Util = require('util') local colors = _G.colors local shell = _ENV.shell @@ -75,7 +74,7 @@ end function page:run(operation, name) local oterm = term.redirect(self.action.output.win) self.action.output:clear() - local cmd = string.format('Package %s %s', operation, name) + local cmd = string.format('package %s %s', operation, name) --for _ = 1, 3 do -- print(cmd .. '\n') -- os.sleep(1) diff --git a/sys/apps/Package.lua b/sys/apps/package.lua similarity index 100% rename from sys/apps/Package.lua rename to sys/apps/package.lua