Fixed bug where SkinFile would always return true on needsUpdate()

when the skin object wasnt initialized.
This commit is contained in:
hns 2001-03-06 21:51:53 +00:00
parent 81ede81781
commit 20e8bb8987
2 changed files with 6 additions and 3 deletions

View file

@ -35,7 +35,7 @@ public class SkinFile implements Updatable {
* the file has been modified or deleted.
*/
public boolean needsUpdate () {
return lastmod != file.lastModified () || !file.exists ();
return (skin != null && lastmod != file.lastModified ()) || !file.exists ();
}

View file

@ -232,8 +232,9 @@ public class TypeManager implements Runnable {
// our plan is to do as little as possible, so first check if anything has changed at all...
for (Iterator i = proto.updatables.values().iterator(); i.hasNext(); ) {
Updatable upd = (Updatable) i.next();
if (upd.needsUpdate ())
if (upd.needsUpdate ()) {
needsUpdate = true;
}
}
String list[] = dir.list();
@ -241,8 +242,9 @@ public class TypeManager implements Runnable {
String fn = list[i];
if (!proto.updatables.containsKey (fn)) {
if (fn.endsWith (app.templateExtension) || fn.endsWith (app.scriptExtension) ||
fn.endsWith (app.actionExtension) || fn.endsWith (app.scriptExtension) || "type.properties".equalsIgnoreCase (fn))
fn.endsWith (app.actionExtension) || fn.endsWith (app.scriptExtension) || "type.properties".equalsIgnoreCase (fn)) {
needsUpdate = true;
}
}
}
@ -251,6 +253,7 @@ public class TypeManager implements Runnable {
// let the thread know we had to do something.
idleSeconds = 0;
app.logEvent ("TypeManager: Updating prototypes for "+app.getName());
// first go through new files and create new items
for (int i=0; i<list.length; i++) {