handle no script being passed
This commit is contained in:
parent
87394e7263
commit
ee984f7d72
|
@ -50,10 +50,6 @@ type script struct {
|
|||
}
|
||||
|
||||
func (m *milkDropWindow) loadScript(scriptPath string) error {
|
||||
if scriptPath == "" {
|
||||
return errors.New("no script given")
|
||||
}
|
||||
|
||||
f, err := os.Open(scriptPath)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -92,10 +88,13 @@ func (m *milkDropWindow) prevPreset() {
|
|||
|
||||
func newMilkDropWindow(width, height int32, scriptPath string) (*milkDropWindow, error) {
|
||||
var m milkDropWindow
|
||||
var err error
|
||||
|
||||
err := m.loadScript(scriptPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
if scriptPath != "" {
|
||||
err = m.loadScript(scriptPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
m.window, err = sdl.CreateWindow("milkbucket", sdl.WINDOWPOS_UNDEFINED, sdl.WINDOWPOS_UNDEFINED, width, height, sdl.WINDOW_OPENGL|sdl.WINDOW_RESIZABLE)
|
||||
|
|
Loading…
Reference in New Issue